private void DoActions(IAction[] _actions, PlugglableStateMachine psm) { foreach (var item in _actions) { item.Act(psm); } }
private void CheckTransitions(PlugglableStateMachine psm) { foreach (var item in _transitions) { if (item.EvaluateConditions(psm)) { return; } } }
public bool EvaluateConditions(PlugglableStateMachine psm) { for (int i = 0; i < _conditions.Length; i++) { if (_conditions[i].Evaluate(psm) == false) { return(false); } } psm.SetState(_transitionToState); return(true); }
public void OnStateExit(PlugglableStateMachine psm) { DoActions(_stateExitActions, psm); }
public void OnStateUpdate(PlugglableStateMachine psm) { DoActions(_stateUpdateActions, psm); CheckTransitions(psm); }
public void OnStateEnter(PlugglableStateMachine psm) { DoActions(_stateEnterActions, psm); }
public abstract void Act(PlugglableStateMachine psm);
public abstract bool Evaluate(PlugglableStateMachine psm);