예제 #1
0
    public void ChangeUI()
    {
        State.GameState gameState = stateReference.GetGameState();
        State.WaveState waveState = stateReference.GetWaveState();

        if (gameState == State.GameState.GameOver)
        {
            OpenWindow(gameOverUI);
        }
        else if (gameState == State.GameState.Buying)
        {
            OpenWindow(buyUI);
            CanPause(false);
        }
        else if (waveState == State.WaveState.Paused)
        {
            OpenWindow(timerUI);
            CanPause(false);
        }
        else if (gameState == State.GameState.Paused)
        {
            OpenWindow(pauseUI);
        }
        else if (gameState == State.GameState.Playing)
        {
            OpenWindow(inGameUI);
        }
    }
예제 #2
0
    void Update()
    {
        if (winButton)
        {
            enemiesLeftThisWave = 0;
        }
        if (loseButton)
        {
            player.GetComponent <IDamageable>().TakeDamage(100);
        }
        if (stateReference.GetGameState() == State.GameState.Playing && stateReference.GetWaveState() == State.WaveState.Spawning)
        {
            if (enemiesLeftThisWave <= 0)
            {
                stateReference.SetWaveStatePaused();
                Scoring.GetInstance().SurvivedWave();
                //StartCoroutine(StartNewWave());
                stateReference.Shop();
                lastGameState = State.GameState.Buying;
            }

            SpawnEnemies();
        }
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (uiManagerInstance.GetCanPause())
            {
                if (stateReference.GetGameState() == State.GameState.Paused)
                {
                    stateReference.UnPauseGame();
                }
                else
                {
                    stateReference.PauseGame();
                }
            }
        }
    }