Ejemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     if (!isPaused)
     {
         if (pauseText.text != "You Win!" && pauseText.text != "You Lose.")
         {
             string seconds = "";
             elapsedTime   += Time.deltaTime;
             seconds        = elapsedTime.ToString("f1");
             timerText.text = seconds;
         }
         else if (pauseText.text == "You Win!")
         {
             isPaused = true;
             //Scores.createRunningScore (200.0f-float.Parse (timerText.text));
             Scores.AddToScores(Mathf.Round(200.0f - float.Parse(timerText.text) + Scores.readRunningScore()));
             print(Scores.readRunningScore());
         }
     }
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         if (pauseText.text == "" || pauseText.text == "Paused")
         {
             isPaused = !isPaused;
         }
         if (pauseText.text == "" && pauseText.text != "You Lose." && pauseText.text != "You Win!" &&
             pauseText.text != "Paused")
         {
             pauseText.text = "Paused";
             mazeControlObject.SendMessage("pauseGhosts");
             GameObject.FindGameObjectWithTag("Player").SendMessage("Pause");
         }
         else if (pauseText.text == "Paused")
         {
             pauseText.text = "";
             mazeControlObject.SendMessage("resumeGhosts");
             GameObject.FindGameObjectWithTag("Player").SendMessage("Unpause");
         }
     }
 }