diff options
author | cross28 <icross028@gmail.com> | 2022-04-18 04:49:39 -0500 |
---|---|---|
committer | cross28 <icross028@gmail.com> | 2022-04-18 04:49:39 -0500 |
commit | a4d4850cd3e2d17ffa952203f86bf4fbe54a01c2 (patch) | |
tree | 4bad1628cc223bbd40bd5a593c8bf9576fda0402 /Assets/Scripts/Actors/Actor.cs | |
parent | e6e9c0826f2d622caefa5e1a99d643a85f4c058f (diff) |
feat: code cleanup for audio manager
Diffstat (limited to 'Assets/Scripts/Actors/Actor.cs')
-rw-r--r-- | Assets/Scripts/Actors/Actor.cs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Assets/Scripts/Actors/Actor.cs b/Assets/Scripts/Actors/Actor.cs index e7f1a83..eb8185e 100644 --- a/Assets/Scripts/Actors/Actor.cs +++ b/Assets/Scripts/Actors/Actor.cs @@ -21,9 +21,11 @@ namespace MontanaJohns.Actors protected SpriteRenderer _renderer; protected Animator _animator; protected Transform _transform; + protected AudioManager _audio; protected Active activeItem; protected bool isGrappling; + protected bool isMoving; protected Vector2? grapplePoint = null; protected LayerMask groundLayers; protected Collection<Item> items; @@ -42,6 +44,7 @@ namespace MontanaJohns.Actors _transform = GetComponent<Transform>(); _renderer = GetComponent<SpriteRenderer>(); _animator = GetComponent<Animator>(); + _audio = FindObjectOfType<AudioManager>(); groundLayers = LayerMask.GetMask("Grapple", "Ground"); _rigidBody.freezeRotation = true; @@ -73,6 +76,7 @@ namespace MontanaJohns.Actors var target = new Vector2(input * stats.speedMultiplier * 10, _rigidBody.velocity.y); _rigidBody.velocity = Vector2.SmoothDamp(_rigidBody.velocity, target, ref acceleration, .05f); _animator.SetBool("moving", Mathf.Abs(_rigidBody.velocity.x) > 1); + isMoving = Mathf.Abs(_rigidBody.velocity.x) > 1; if (_rigidBody.velocity.x < -0.1) { _renderer.flipX = true; |