public void EnableCanvas()
    {
        GetRank();
        //new ship canvas
        GameObject          canvasManager = GameObject.Find("CanvasManager");
        ToggleNewShipCanvas NSCS          = canvasManager.GetComponent <ToggleNewShipCanvas> ();

        if (highScore == true)
        {
            // toggle Highscore canvas if the get rank showed it can
            ToggleHighScoreCanvas toggleHS = canvasManager.GetComponent <ToggleHighScoreCanvas> ();
            toggleHS.Toggle();
            TotalScore();
            // display the rank and reset the values
            DisplayRank();
            highScore = false;
        }
        else
        {
            // no new highscore then check for new ship if not just gameover canvas
            if (NSCS.newShip == true)
            {
                Debug.Log("TOGGLE NSCS");
                NSCS.Toggle();
                NSCS.newShip = false;
            }
            else
            {
                //if not then just toggle the gameover canvas
                ToggleGameOverCanvas toggleGO = canvasManager.GetComponent <ToggleGameOverCanvas>();
                toggleGO.Toggle();
            }
        }
    }
Пример #2
0
    void Update()
    {
        GameObject ship = GameObject.FindWithTag("Ship");

        // short cut key to restart the game
        if (Input.GetKeyDown(KeyCode.R) && ship == null)
        {
            // toggle off the restart canvas
            GameObject           canvasManager = GameObject.Find("CanvasManager");
            ToggleGameOverCanvas canvasScript  = canvasManager.GetComponent <ToggleGameOverCanvas>();
            canvasScript.Toggle();
            // then restart the game
            Restart();
        }
    }