コード例 #1
0
ファイル: GameManager.cs プロジェクト: 1mgames/GameOff_2019
    private void Start()
    {
        // 状態が変わった時にだけ呼び出される
        this.UpdateAsObservable()
        .Select(_ => _state)
        .DistinctUntilChanged()
        .Subscribe(_ =>
        {
            switch (_)
            {
            case GameState.Title:
                {
                    break;
                }

            case GameState.Initialize:
                {
                    _cameraView.ChangeBloom(1, 1.25f);
                    _cameraView.ChangeDepthOfField(5, 1.5f);
                    _player.Initialize();
                    break;
                }

            case GameState.Game:
                {
                    break;
                }

            case GameState.Retry:
                {
                    _cameraView.ChangeDepthOfField(3, .5f);
                    FloorManager.Instance.Retry();
                    _player.JumpUp();
                    _player.Restore();
                    break;
                }

            case GameState.FloorUp:
                {
                    FloorManager.Instance.FloorUp();
                    _player.JumpUp();
                    break;
                }

            case GameState.Upgrade:
                {
                    _upgradController.Setup();
                    break;
                }

            case GameState.GameOver:
                {
                    if (Time.timeScale != 1)
                    {
                        Time.timeScale = 1;
                        CameraVignette(0.25f, 0.7f);
                    }

                    _cameraView.ChangeDepthOfField(2, .5f);
                    _gameOverController.GameOver();
                    break;
                }

            case GameState.GameClear:
                {
                    if (Time.timeScale != 1)
                    {
                        Time.timeScale = 1;
                        CameraVignette(0.25f, 0.7f);
                    }

                    _cameraView.ChangeBloom(5, 0.5f);
                    _cameraView.ChangeDepthOfField(1, 1f);
                    _gameClearController.GameClear(_player.GetTotalTime(), _player.GetCoin());
                    break;
                }

            case GameState.Restart:
                {
                    _cameraView.ChangeBloom(50, 0.25f);
                    _cameraView.ChangeDepthOfField(5, 2f);

                    FloorManager.Instance.Restart();
                    _player.JumpUp();
                    _player.Restart();

                    break;
                }
            }
        });
    }