コード例 #1
0
    void CheckParameters()           //A Function used to make sure values have been set. If GameObject variables have NULL Value, prints out Error to Log and Exits Game
    {
        if (GetPauseMenuObj != null) //Checks to see if GameObject is set to NULL
        {
            Debug.Log("Object paired to pauseMenuObj successfully!");
        }
        else
        {
            Debug.LogError("Unable to find object with Tag 'Pause Menu'", pauseMenuObj);
            Application.Quit(); //Closes the Game
        }

        GetPauseMenuObj.SetActive(false); //Sets GetPauseMenuObj to Inactive (Should be hidden when starting game)

        if (GetEndScreenObj != null)      //Checks to see if GameObject is set to NULL
        {
            Debug.Log("Object paired to endScreenObj successfully!");
        }
        else
        {
            Debug.LogError("Unable to find object with Tag 'End Screen'", endScreenObj);
            Application.Quit(); //Closes the Game
        }

        GetEndScreenObj.SetActive(false); //Sets GetEndScreenObj to Inactive (Should be hidden when starting game)

        if (GetPlayerUI != null)          //Checks to see if GameObject is set to NULL
        {
            Debug.Log("Object paired to playerUI successfully!");
        }
        else
        {
            Debug.LogError("Unable to find object with Tag 'Player UI'", playerUI);
            Application.Quit(); //Closes the Game
        }

        if (GetGameOverScreen != null) //Checks to see if GameObject is set to NULL
        {
            Debug.Log("Object paired to gameOver successfully!");
        }
        else
        {
            Debug.LogError("Unable to find object with Tag 'Game Over'", gameOverScreenObj);
            Application.Quit(); //Closes the Game
        }

        GetGameOverScreen.SetActive(false); //Sets GetGameOverScreen to Inactive (Should be hidden when starting game)
    }
コード例 #2
0
    void CheckParameters()           //A Function used to make sure values have been set. If GameObject variables have NULL Value, prints out Error to Log and Exits Game
    {
        if (GetPauseMenuObj != null) //Checks to see if GameObject is set to NULL
        {
            Debug.Log("Object paired to pauseMenuObj successfully!");
        }
        else
        {
            Debug.LogError("Unable to find object with Tag 'Pause Menu'", pauseMenuObj);
            Application.Quit(); //Closes the Game
        }

        GetPauseMenuObj.SetActive(false); //Sets GetPauseMenuObj to Inactive (Should be hidden when starting game)

        if (GetPlayerUI != null)          //Checks to see if GameObject is set to NULL
        {
            Debug.Log("Object paired to playerUI successfully!");
        }
        else
        {
            Debug.LogError("Unable to find object with Tag 'Player UI'", playerUI);
            Application.Quit(); //Closes the Game
        }

        for (int i = 0; i < 4; i++)        //The For Loop goes through the entire array to check for a NULL Value
        {
            if (GetUsableItems[i] != null) //Checks to see if GameObject is set to NULL
            {
                Debug.Log("Object usableItem" + i + " paired to playerUI successfully!");
            }
            else
            {
                Debug.LogError("Unable to find object with Name 'usableItem" + i, usableItems[i]);
                Application.Quit(); //Closes the Game
            }

            if (GetCollectedItems[i] != null) //Checks to see if GameObject is set to NULL
            {
                Debug.Log("Object collectedItems" + i + " paired to playerUI successfully!");
            }
            else
            {
                Debug.LogError("Unable to find object with Name 'usableItem" + i, collectedItems[i]);
                Application.Quit(); //Closes the Game
            }
        }
    }
コード例 #3
0
    void Update()
    {
        if (FindObjectOfType <ObjectClicker>().Item1sent == 1 && //Checks to see if all objects have been found
            FindObjectOfType <ObjectClicker>().Item2sent == 1 &&
            FindObjectOfType <ObjectClicker>().Item3sent == 1 &&
            FindObjectOfType <ObjectClicker>().Item4sent == 1)
        {
            GetEndScreenObj.SetActive(true);  //Sets the End Screen to True
            GetPauseMenuObj.SetActive(false); //Turns off Pause Menu if it's on
            GetPlayerUI.SetActive(false);     //Sets the Pause Menu object to active so it can be interacted with

            EndScreenScript.gameEnd = true;
            PauseMenuUI.canPause    = false;            //Stops the player from being able to pause
            Time.timeScale          = 0;                //Freezes time so game freezes

            Cursor.lockState = CursorLockMode.Confined; //Locks cursor to the game view (Cannot move mouse outside of it, only works in BUILD, not EDITOR)
            Cursor.visible   = true;                    //Shows Cursor
        }
    }