Пример #1
0
    // Replaces current Superstate with the newState, and resets the transition timer.
    // Each time a transition takes place, the states Action is called via Act().
    public virtual void StateTransition(Substate newState)
    {
        if (!canTransition)
        {
            return;
        }

        // If attempting to transition to the same state, and it can be refreshed...
        if (newState.Equals(finiteState) && finiteState.CanBeRefreshed)
        {
            // Refresh the state
            // Debug.Log("Remain in state, reset timer");
            RefreshState(newState);
        }
        else
        {
            // Transition back to resting state
            TransitionState(newState);
        }
    }
Пример #2
0
 // Check if the current resting state is active.
 public virtual bool IsIdle()
 {
     return(restingState.Equals(finiteState));
 }