Ejemplo n.º 1
0
    private void OnEnable()
    {
        switch (Type)
        {
        case SignalType.GameOver:
            _gameOverSignal.Fire();
            break;

        case SignalType.GameStart:
            _gameStartSignal.Fire();
            break;
        }
    }
Ejemplo n.º 2
0
 public override void Activate()
 {
     base.Activate();
     _gameOverSignal.Fire();
 }
Ejemplo n.º 3
0
        private void ChangeGameState(GameStates state, GameOverType gameOverType)
        {
            if (_currentState == state)
            {
                return;
            }

            switch (state)
            {
            case GameStates.WaitingToStart: {
                _currentState = GameStates.WaitingToStart;
                _waitingToStartSignal.Fire();
                break;
            }

            case GameStates.Playing: {
                if (_currentState == GameStates.Paused)
                {
                    _resumeGameSignal.Fire();
                }

                _currentState = GameStates.Playing;
                Debug.Log(GameStates.Playing);
                break;
            }

            case GameStates.GameOver: {
                _currentState = GameStates.GameOver;

                if (gameOverType == GameOverType.Win)
                {
                    _gameOverSignal.Fire(GameOverType.Win);
                }
                else if (gameOverType == GameOverType.Lose)
                {
                    _gameOverSignal.Fire(GameOverType.Lose);
                }

                break;
            }

            case GameStates.StartGame: {
                _currentState = GameStates.StartGame;
                Debug.Log(_currentState);
                _startGameSignal.Fire();
                break;
            }

            case GameStates.Paused: {
                _currentState = GameStates.Paused;
                Debug.Log(_currentState);
                _gamePausedSignal.Fire();

                break;
            }

            default: {
                break;
            }
            }
        }