Beispiel #1
0
    //called when the current wave is considered over
    void WaveCompleted()
    {
        Debug.Log("Wave completed!");

        state = SpawnState.COUNTING;

        Wave current = waves[nextWave];

        su.addScore(current.scoreOnFinished);
        if (current.timeToHandle > 0f)
        {
            waveCountdown = current.timeToHandle;
        }
        else
        {
            waveCountdown = timeBetweenWaves;
        }

        //if last wave we display the end
        if (isLastWave())
        {
            state = SpawnState.WAITING;
            GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>().gameHasWon = true;
            Debug.Log("All wave completed");
        }
        else
        {
            GameObject.FindGameObjectWithTag("Hud").GetComponent <PlayerHealth>().RestoreHealth();
            nextWave++;
        }
    }