コード例 #1
0
    public void RestartGame()
    {
        AnalyticsEvent.GameStart();

        foreach (ParticleSystem ps in ZoneScript.ParticleSystems)
        {
            ps.Play();
        }

        DeletePlayer();
        PlanetScript.DeletePlanet();

        GameObject objectController = GameObject.FindGameObjectWithTag("ObjectController");

        DeleteObjectStuff(objectController);

        ZoneScript.ResetZone();

        if (ZoneScript.ZoneCompleteText != null)
        {
            ZoneScript.ZoneCompleteText.DisplayText = false;
        }

        //Start the spawning objects again
        objectController.GetComponent <ObjectSpawner>().SpawnerStart();

        //Respawn the player
        PlayerSpawner playerSpawnerScript = GameObject.FindGameObjectWithTag("PlayerSpawner").GetComponent <PlayerSpawner>();

        playerSpawnerScript.SpawnPlayer();

        //Reset the points
        points = 0;
        lives  = 3;
        UpdateScore();
        UpdateLives();
    }