18 lines
416 B
C#
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();
|
|
}
|
|
}
|
|
}
|
|
}
|