Beispiel #1
0
    public void TrySetState(CharacterState newState, bool allowEnterSameState = false)
    {
        if (newState != currentState || !allowEnterSameState)
        {
            if ((currentState != null && !currentState.CanSwitchTo(newState)) || !newState.CanBeSet())
            {
                return;
            }
        }

        if (debug)
        {
            Debug.Log(string.Format("{0}->{1}", currentState == null ? null : currentState.ToString(), newState));
        }

        currentState = newState;

        UpdateEvaluationBlock();
    }