Пример #1
0
    /*
     * hintBoard = GameObject.Find ("HintBoard");
     *      hintBoardScript = hintBoard.GetComponent<HintBoard>();
     *      Acquire object like this.
     * */

    void Update()
    {
        if (!gameOver)
        {
            time += Time.deltaTime;
            //Debug.Log (time);

            if (spawnedLastPredator)
            {
                GameObject[] arr = GameObject.FindGameObjectsWithTag("Carnivore");

                if (arr.Length == 0)
                {
                    buildMenu       = GameObject.Find("MainCamera");
                    buildMenuScript = buildMenu.GetComponent <BuildMenu>();


                    drawYouWon = true;
                    gameOver   = true;

                    buildMenuScript.endGame();
                }
            }
        }
    }
Пример #2
0
    void OnGUI()
    {
        if (GameIsOver) {

          		spawnPredator = GameObject.Find ("PredatorSpawner");
            spawnPredatorScript = spawnPredator.GetComponent<SpawnPredator>();

            spawnPredatorScript.stopRunTime();

            // draw resource menu
            GUILayout.BeginArea (new Rect (350, 350, 600, 600));
            GUILayout.BeginHorizontal ("box");

            GUILayout.Label("You Lost!", largeFont);

            // end GUI for resource menu
            GUILayout.EndHorizontal ();
            GUILayout.EndArea ();

            if (GUI.Button (new Rect (360, 420, 140, 30), "Return to Lobby")) {
                Destroy (this);
                Game.SwitchScene("World");
            }

        }

        if (GameIsOver && !endedGame) {
            endedGame = true;

            buildMenu = GameObject.Find ("MainCamera");
            buildMenuScript = buildMenu.GetComponent<BuildMenu>();

            buildMenuScript.endGame();

        }
    }
    void OnGUI()
    {
        if (GameIsOver)
        {
            spawnPredator       = GameObject.Find("PredatorSpawner");
            spawnPredatorScript = spawnPredator.GetComponent <SpawnPredator>();

            spawnPredatorScript.stopRunTime();

            // draw resource menu
            GUILayout.BeginArea(new Rect(350, 350, 600, 600));
            GUILayout.BeginHorizontal("box");

            GUILayout.Label("You Lost!", largeFont);

            // end GUI for resource menu
            GUILayout.EndHorizontal();
            GUILayout.EndArea();

            if (GUI.Button(new Rect(360, 420, 140, 30), "Return to Lobby"))
            {
                Destroy(this);
                Game.SwitchScene("World");
            }
        }

        if (GameIsOver && !endedGame)
        {
            endedGame = true;

            buildMenu       = GameObject.Find("MainCamera");
            buildMenuScript = buildMenu.GetComponent <BuildMenu>();

            buildMenuScript.endGame();
        }
    }