/// 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); }
/// 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; }
/// 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; }
/// 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); }