Example #1
0
    IEnumerator endGame()
    {
        Camera.main.GetComponent <CameraBehavior> ().gameOver = true;
        Camera.main.GetComponent <CameraBehavior> ().zoomToStartingHeight();         //change zoom to the building clusters


        gamePlayer.GetComponent <playerMovement> ().gameOver = true;
        goalMan.StartCoroutine("enableClusters");


        yield return(new WaitForSeconds(3f));


        Camera.main.GetComponent <CameraBehavior> ().zoomOnClusters(goalMan.GetComponent <MoveClusters>().ClustersCenter);

        //delete/disable player
        if (gamePlayer.activeInHierarchy)
        {
            gamePlayer.SetActive(false);
        }

        //delete/disable trainstations
        foreach (GameObject station in stationMan.stations)
        {
            if (station.activeInHierarchy)
            {
                station.SetActive(false);
            }
        }
        //disable spawngoal
        goalMan.deSelectSpawnGoal();

        if (walls != null)
        {
            walls.SetActive(false);
        }
    }