using Enemies.States; using UnityEngine; namespace Enemies { public class FollowState: IState { private Enemy context; public FollowState(Enemy context) { this.context = context; } public void Enter() { Debug.Log("Entering Follow State"); context.currentState = Enemy.States.Follow; } public void Execute() { //Determine direction to target Vector2 direction = context.target.transform.position - context.transform.position; //Move in desired direction context.transform.Translate(direction.normalized * context.speed * Time.deltaTime); } public void Exit() { } } }