namespace V3.AI.Internal
{
///
/// Abstract implementation of IAction.
///
public abstract class AbstractAction : IAction
{
///
/// The current state of the action.
///
public ActionState State { get; private set; } = ActionState.Waiting;
///
/// Start the execution of the action.
///
public virtual void Start()
{
State = ActionState.Executing;
}
///
/// Update the execution state. This method should be repateatingly
/// called as long as State is Executing.
///
public virtual void Update()
{
if (State != ActionState.Executing)
return;
State = GetNextState();
}
///
/// Returns the next state of this action. It is guaranteed that the
/// current state is Executing.
///
protected abstract ActionState GetNextState();
}
}