private void PauseGame()
    {
        Time.timeScale = 0;
        gameStatus     = GameStatus.Paused;

        pauseOverlay.FadeIn();

        player.StopMoving();
        asteroidSpawner.StopSpawning();
    }
示例#2
0
    void DoRespawn()
    {
        // Face the starting rotation
        ship.gameObject.transform.rotation = startingRotation;
        // Activate the ship
        ship.gameObject.SetActive(true);
        // Remove the "you died!" text
        deadText.gameObject.SetActive(false);

        // Start the asteroids spawning again
        spawner.StopSpawning(false);
    }
    void Die()
    {
        // Decrement the number of lives
        Statistics.lives--;

        // Stop spawning asteroids
        spawner.StopSpawning(true);

        // Get rid of ship
        this.gameObject.SetActive(false);
        hearts[Statistics.lives].SetActive(false);

        // Show "you died" text
        if (Statistics.lives > 0)
        {
            gm.GetComponent <Respawn>().deadText.gameObject.SetActive(true);
        }
        else
        {
            gm.GetComponent <Respawn>().gameOverText.GetComponent <Text>().text = "GAME OVER!\n\nScore: " + Statistics.shotAsteroids + "\n\nClick to Continue";
            gm.GetComponent <Respawn>().gameOverText.gameObject.SetActive(true);
        }
    }