Exemple #1
0
    //-----------Utilities -------------------

    public GameState SwitchStateTo(GameState state)
    {
        switch (this.CurrentState)
        {
        case GameState.Loading:
            FinishLoad();
            break;

        case GameState.Day:
            FinishDay();
            break;

        case GameState.Night:
            FinishNight();
            break;

        case GameState.Dead:
            FinishDead();
            break;
        }

        switch (state)
        {
        case GameState.Loading:
            InitLoad();
            break;

        case GameState.Day:
            InitDay();
            break;

        case GameState.Night:
            InitNight();
            break;

        case GameState.Dead:
            InitDead();
            break;
        }

        LightingManager.ChangeLight(state);

        //Reactive Objects

        foreach (ReactiveObject obj in GlobalGame.UnitManager.ReactiveObjectList)
        {
            obj.OnGameStateChange(state);
        }

        //

        GameState lastState = this.CurrentState;

        this.CurrentState           = state;
        GlobalGame.CurrentGameState = state;
        return(lastState);
    }