예제 #1
0
    //Changes the current game state
    public void SetState(System.Type newStateType)
    {
        if (currentState != null)
        {
            currentState.OnDeactivate();
        }

        currentState = GetComponentInChildren(newStateType) as _StatesBase;
        if (currentState != null)
        {
            currentState.OnActivate();
        }
    }
예제 #2
0
    //Changes the current game state
    public void SetState(System.Type newStateType)
    {
        Debug.Log_cyan($"SetState > {newStateType}", this, 2);

        if (currentState != null)
        {
            currentState.OnDeactivate();
        }

        currentState = GetComponentInChildren(newStateType) as _StatesBase;
        if (currentState != null)
        {
            currentState.OnActivate();
        }
    }