Exemplo n.º 1
0
 void ChangeState(FiniteState newState)
 {
     if (currentState != null){
         currentState.OnExit(target);
     }
     currentState = newState;
     // TODO Assert(currentState != null);
     currentState.OnEnter(target);
 }
Exemplo n.º 2
0
 void SetDefaultToCurrent()
 {
     currentState = defaultState;
 }
Exemplo n.º 3
0
 protected void AddState(FiniteState state)
 {
     // not allow same-name state
     // Assert(!allStates.ContainsKey(state.Name));
     allStates.Add(state.Name, state);
 }
Exemplo n.º 4
0
 protected void RemoveState(FiniteState state)
 {
     allStates.Remove(state.Name);
 }
Exemplo n.º 5
0
 bool TryGetNextStateByEventName(FiniteStateTransition transation, string eventName, out FiniteState state)
 {
     state = null;
     if (currentState == null || !currentState.Name.Equals(transation.LastStateName)) return false;
     if (!eventName.Equals(transation.EventName)) return false;
     return (allStates.TryGetValue(transation.NextStateName, out state));
 }