Beispiel #1
0
 /// This can be called by any of this character's states in order to transition to a new one.
 /// The optional transition info provided is passed to the new state when it is Enter()-ed.
 public void ChangeState <N>(CharacterStateTransitionInfo transitionInfo = null) where N : S
 {
     state?.ForceCleanUp(input);
     state = stateMap[typeof(N)];
     softTransitionChangeState = null;
     state.Enter(input, transitionInfo);
 }
Beispiel #2
0
 /// This can be called by any of this character's states in order to transition to a new one.
 /// The optional transition info provided is passed to the new state when it is Enter()-ed.
 public void ChangeState <N>(CharacterStateTransitionInfo transitionInfo = null) where N : S
 {
     state?.ForceCleanUp(input);
     state = stateMap[typeof(N)];
     softTransitionChangeState = null;
     stateChanged.Value        = true;
     info = transitionInfo;
 }
Beispiel #3
0
 /// This can be called by any of this character's states in order to transition to a new one.
 /// The optional transition info provided is passed to the new state when it is Enter()-ed.
 public void ChangeState <N>(CharacterStateTransitionInfo transitionInfo = null) where N : S
 {
     if (state != null)
     {
         state.ForceCleanUp(stateInput);
     }
     state = stateMap[typeof(N)]; //gets the numerical representation of the State you put in, then uses that as a key to get the actual instantiated state we put into the statemap before
     softTransitionChangeState = null;
     stateChanged.Value        = true;
     info = transitionInfo;
 }
Beispiel #4
0
 /// Gives the current state a gentle warning that it should transition as soon as possible to the given state N
 public void ChangeStateSoft <N>(CharacterStateTransitionInfo transitionInfo = null) where N : S
 {
     softTransitionChangeState = () => ChangeState <N>(transitionInfo);
     state.SoftTransitionWarning(stateInput);
 }