Example #1
0
 public bool Transit(APlayerState toState)
 {
     //TODO:[Gafgar: Sat/01-02-2020] implement recursive guard!
     if (toState.CanEnter(this, mState))
     {
         mState.Exit(this, toState);
         var oldState = mState;
         mState = toState;
         mState.Enter(this, oldState);
         return(true);
     }
     return(false);
 }
Example #2
0
 //Called when chaining to a new state. Before the new state can call enter. NOTICE: Never call transit from within the enter or exit functions to avoid recursive.
 public virtual void Exit(PlayerController p, APlayerState toState)
 {
 }
Example #3
0
 //Called after previous state have exited. NOTICE: Never call transit from within the enter or exit functions to avoid recursive.
 //Enter on the default state must be able to accept null as the from state.
 public virtual void Enter(PlayerController p, APlayerState fromState)
 {
 }
Example #4
0
 //return if we can enter this state or not (check for prerequisites if there are any)
 public virtual bool CanEnter(PlayerController p, APlayerState fromState)
 {
     return(true);
 }
Example #5
0
 public override void Enter(PlayerController p, APlayerState fromState)
 {
     mTimer = 0;
 }