예제 #1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetButtonDown("Cancel") && died != false)
     {
         script1.DeleteMob();
         script1.EndBegin();
         script2.DeleteSpawner();
         script2.EndBegin();
         script3.DeleteHuman();
         script3.EndBegin();
         script4.DeleteBrains();
         script4.EndBegin();
         script5.DeletePlayer();
         script5.EndBegin();
         script6.EndBegin();
         Menu1.gameObject.SetActive(true);
         Menu2.gameObject.SetActive(false);
         Menu3.gameObject.SetActive(false);
         Init(1);
     }
     if (died)
     {
         script5.pauseText.gameObject.SetActive(false);
         script5.playText.gameObject.SetActive(false);
         script5.pauseText2.gameObject.SetActive(false);
         script5.pausemenu.gameObject.SetActive(false);
         script5.pause.onClick.RemoveAllListeners();
         if (script5.GetScore() > hiscore)
         {
             hiscore = script5.GetScore();
             score.SetScore(hiscore);
             SubmitScore(hiscore);
         }
         timer1 += Time.deltaTime;
         if (timer1 > 2 && scale > 15)
         {
             timer2 += Time.deltaTime;
             scale   = scale - timer2 * 2;
             GameOverImage1.rectTransform.localScale = new Vector3(1, 1, 1) * scale;
         }
         else if (scale < 15)
         {
             if (GameOverImage2.fillAmount < 1)
             {
                 timer3 += Time.deltaTime;
                 GameOverImage2.fillAmount += timer3 * 0.5f;
             }
             if (GameOverImage2.fillAmount == 1)
             {
                 Menu3.gameObject.SetActive(true);
                 died           = false;
                 Time.timeScale = 1;
                 script5.pause.onClick.RemoveAllListeners();
                 script1.DeleteMob();
                 script1.EndBegin();
                 script2.DeleteSpawner();
                 script2.EndBegin();
                 script3.DeleteHuman();
                 script3.EndBegin();
                 script4.DeleteBrains();
                 script4.EndBegin();
                 script5.EndBegin();
                 script5.DeletePlayer();
                 script6.EndBegin();
                 Menu1.gameObject.SetActive(false);
                 Menu2.gameObject.SetActive(false);
                 Menu3.gameObject.SetActive(true);
                 Init(3);
             }
         }
     }
 }