Пример #1
0
 public static void BroadcastGameStateChange(GameSystem.GameState _gameState)
 {
     if (onGameStateChange == null)
     {
         return;
     }
     onGameStateChange(_gameState);
 }
    protected override void Update()
    {
        if (GameSystem.instance.gameState == GameSystem.GameState.Wave || GameSystem.instance.gameState == GameSystem.GameState.PauseMenu || GameSystem.instance.gameState == GameSystem.GameState.Shop) // KeyDown doesn't work well with fixed update so we need to do it here
        {
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                if (GameSystem.instance.gameState != GameSystem.GameState.PauseMenu)
                {
                    pauseMenu.gameObject.SetActive(true);
                    previousState = GameSystem.instance.gameState; // Store previous state so we can get back to it when pressing Escape again
                    GameSystem.instance.gameState = GameSystem.GameState.PauseMenu;
                }
                else
                {
                    pauseMenu.SetActive(false);
                    GameSystem.instance.gameState = previousState;
                }
            }
        }

        base.Update();
    }
Пример #3
0
    private void OnGameStateChange(GameSystem.GameState _gameState)
    {
        switch (_gameState)
        {
        case GameSystem.GameState.PLAY:
            PlayTrackList();
            break;

        case GameSystem.GameState.GAMEOVER:
            m_audioSource.pitch = 1.0f;
            PlayEndOfMatchList();
            break;

        case GameSystem.GameState.RETRY:

            break;

        case GameSystem.GameState.MENU:
            //m_audioSource.pitch = 1.0f;
            //PlayMenuList();

            m_parent.StartCoroutine(this.PlaySound());
            break;

        case GameSystem.GameState.PAUSE:

            break;

        case GameSystem.GameState.QUIT:

            break;

        default:
            break;
        }
        ;
    }
Пример #4
0
 private void OnEnable()
 {
     previousState = GameSystem.instance.gameState; // Store previous state so we can get back to it when pressing continue
 }
 private void OnEnable()
 {
     GetComponent <Text>().color = Color.white;
     previousState = GameSystem.instance.gameState; // Store previous state so we can get back to it when pressing continue
 }