コード例 #1
0
    public void MoveNext(GamePhase type)
    {
        if (currentState != null)
        {
            Debug.Log("MoveNext first state " + currentState.ToString());
            currentState.OnExit();
        }

        if (type != GamePhase.ResumeGame)
        {
            try
            {
                String commentary = "State manager go to the state " + type.ToString();
            }
            catch (Exception e)
            {
                Debug.Log(e.Message);
            }

            GameManager.instance.SetCurrentState(type);
            Visual.instance.DisableVisualElementsOnStateEnter();
            GameLogicEvents.CopyGameActorsToCurrentGame();
            SaveLoadHelper.Save(SaveLoadHelper.defaultPrefixString);
            GameManager.instance.RemoveStateComponentsFromActor();

            Visual.instance.UpdateCounters();
        }

        currentState = dictionary[type];

        Visual.instance.disableInput(false);
        currentState.OnEnter();
    }
コード例 #2
0
    public void SetState(iState state)
    {
        if (state == _CurrentState)
        {
            return;
        }

        _CurrentState?.OnExit();
        _CurrentState = state;

        _transitions.TryGetValue(_CurrentState.GetType(), out _CurrentTransitions);
        if (_CurrentTransitions == null)
        {
            _CurrentTransitions = EmptyTransitions;
        }

        _CurrentState.OnEnter();
    }