using UnityEngine; public class EnemyAI : Character { protected override void OnDeath() { throw new System.NotImplementedException(); } protected override void SetClimbingAnimation(bool isClimbing) { } protected override void SetWalkingAnimation(bool isWalking) { } private void Update() { float horizontal = 0; float vertical = 0; if (Player.Instance.transform.position.x - transform.position.x < -0.05f && isAllowLeft) { horizontal = -1; } else if (Player.Instance.transform.position.x - transform.position.x > 0.05f && isAllowRight) { horizontal = 1; } else if (Mathf.Abs(Player.Instance.transform.position.y - transform.position.y) > 0.05f && isAllowVertical) { var deltaY = Player.Instance.transform.position.y - transform.position.y; vertical = deltaY > 0 ? 1 : -1; } base.MoveTo(horizontal, vertical); } }