player walk animation

This commit is contained in:
2023-06-29 14:51:46 +03:00
parent e8b52c1062
commit bdb4bfd3c3
4 changed files with 68 additions and 11 deletions
+4 -3
View File
@@ -1,6 +1,6 @@
using UnityEngine;
public class Character : MonoBehaviour
public abstract class Character : MonoBehaviour
{
[SerializeField]
protected Animator _animator;
@@ -65,7 +65,7 @@ public class Character : MonoBehaviour
FlipCharacter();
}
//animator.SetBool("Walk", h_movement != 0);
SetWalkingAnimation(h_movement != 0);
_isOnLadder = mapElement == MapElementType.Ladder || GetMapElement(Vector2.up) == MapElementType.Ladder;
if (_isOnLadder)
@@ -105,6 +105,7 @@ public class Character : MonoBehaviour
return MapElementType.Empty;
}
protected abstract void SetWalkingAnimation(bool isWalking);
private void FixedUpdate()
{
@@ -119,7 +120,7 @@ public class Character : MonoBehaviour
if (_isFalling)
{
_body.velocity = new Vector2(0, _body.velocity.y);
//animator.SetBool("Walk", false);
SetWalkingAnimation(false);
if (GetMapElement(Vector2.down)==MapElementType.Ladder)
{