Exemple #1
0
 private void DoActions(IAction[] _actions, PlugglableStateMachine psm)
 {
     foreach (var item in _actions)
     {
         item.Act(psm);
     }
 }
Exemple #2
0
 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);
 }
Exemple #4
0
 public void OnStateExit(PlugglableStateMachine psm)
 {
     DoActions(_stateExitActions, psm);
 }
Exemple #5
0
 public void OnStateUpdate(PlugglableStateMachine psm)
 {
     DoActions(_stateUpdateActions, psm);
     CheckTransitions(psm);
 }
Exemple #6
0
 public void OnStateEnter(PlugglableStateMachine psm)
 {
     DoActions(_stateEnterActions, psm);
 }
 public abstract void Act(PlugglableStateMachine psm);
Exemple #8
0
 public abstract bool Evaluate(PlugglableStateMachine psm);