Example #1
0
    void Update()
    {
        TimeCount += Time.deltaTime;
        int   Minute = (int)TimeCount / 60;
        float Second = (int)TimeCount % 60;

        TimeText.text = Minute.ToString("00") + " : " + Second.ToString("00");

        if (TimeCount <= 0)
        {
            TimeText.text = "00 : 00";
        }

        if (Player1_BackGround_Script.GetCheckDeadbyKilled() == true)
        {
            Player2_BackGround_Script.SetMoreEnemy(true);
            Player1_BackGround_Script.SetCheckDeadbyKilled(false);
        }

        if (Player2_BackGround_Script.GetCheckDeadbyKilled() == true)
        {
            Player1_BackGround_Script.SetMoreEnemy(true);
            Player2_BackGround_Script.SetCheckDeadbyKilled(false);
        }

        if (Player1_BackGround_Script.GetEndTime() == true || Player2_BackGround_Script.GetEndTime() == true)
        {
            ExitImage.SetActive(true);
            KeyButton.SetActive(true);

            if (Player1_BackGround_Script.GetEndTime() == true)
            {
                ExitText.text = "2P WIN!!";
                Player1_BackGround_Script.SetEndTime(true);
            }
            else
            {
                ExitText.text = "1P WIN!!";
                Player2_BackGround_Script.SetEndTime(true);
            }

            TimeText.text = "";
            Destroy(GameObject.Find("Hunter(Clone)"));
            Destroy(GameObject.Find("Mage(Clone)"));
            Destroy(GameObject.Find("Priest(Clone)"));
            Destroy(Player1_BackGround);
            Destroy(Player2_BackGround);
            if (Input.anyKeyDown)
            {
                StartCoroutine(ChangeGameScene());
            }
        }
    }