コード例 #1
0
    void SetAllText()
    {
        if (time > 0)
        {
            Timer.text = "Time Left: " + time;
        }
        else if (time <= 0)
        {
            Timer.text = "Time Left: 0";
        }

        if (time <= 10)
        {
            Instructions.text = "";
        }

        if (time > 0 && Locks <= 0 && LoseText.text != "You Lose!")
        {
            WinText.text      = "You Win!!!";
            gameOverText.text = "Game Created By Ryan Witherow";
            winMusic.ChangeBM(musicClipTwo);
            musicSource.loop = false;

            gameOver = true;
            restart  = true;

            restartText.text = "Press 'Q' to Restart";
        }

        else if (Locks != 0 && Timer.text == "Time Left: 0" && WinText.text != "You Win!!!")
        {
            if (jail == 0)
            {
                Instantiate(JailSprite, transform.position, Quaternion.identity);
                jail += 1;
            }
            LoseText.text     = "You Lose!";
            gameOverText.text = "Game Created By Ryan Witherow";
            loseMusic.ChangeBM(musicClipThree);
            musicSource.loop = false;

            gameOver = true;
            restart  = true;

            restartText.text = "Press 'Q' to Restart";
        }
    }
コード例 #2
0
    void Update()
    {
        if (Input.GetKey("escape"))
        {
            Application.Quit();
        }

        if (restart == true)
        {
            if (Input.GetKeyDown(KeyCode.Q))
            {
                SceneManager.LoadScene("10 Second Game");
            }
        }

        if (time <= 10 && LoseText.text != "You Lose!" && WinText.text != "You Win!!!")
        {
            stagemusic.ChangeBM(musicClipOne);
            musicSource.loop = true;
        }
    }