TowerDefenseGame/Assets/Scripts/Runtime/AI/Base/AgentController.cs
2025-06-28 14:49:54 -07:00

18 lines
416 B
C#

using UnityEngine;
namespace AI.Base {
public abstract class AgentController : MonoBehaviour {
protected IState currentState;
protected virtual void Update() {
currentState?.Tick();
IState next = currentState?.CheckTransitions();
if (next != null && next != currentState) {
currentState.OnExit();
currentState = next;
currentState.OnEnter();
}
}
}
}