public void end()
 {
     GameOver = true;
     if (ended == false)
     {
         if (GoodScore > PlayerPrefs.GetFloat("AnimalHighScore"))
         {
             PlayerPrefs.SetFloat("AnimalHighScore", GoodScore);
         }
         CancelInvoke();
         Survival sur = FindObjectOfType(typeof(Survival)) as Survival;
         sur.CancelInvoke();
         GameObject b = Instantiate(EndPanel) as GameObject;
         b.GetComponentInChildren <Text> ().text = "Score: " + GoodScore;
         Canvas can = FindObjectOfType(typeof(Canvas)) as Canvas;
         b.transform.SetParent(can.transform);
         b.transform.localScale    = new Vector3(1, 1, 1);
         b.transform.localPosition = new Vector3(0, 0, 0);
         ended = true;
         if (this.interstitial.IsLoaded())
         {
             this.adClosed = false;
             this.interstitial.Show();
         }
     }
 }
Exemplo n.º 2
0
 public void end()
 {
     Debug.Log("Game Over");
     GameOver = true;
     if (ended == false)
     {
         if (GoodScore > PlayerPrefs.GetFloat("AnimalHighScore"))
         {
             PlayerPrefs.SetFloat("AnimalHighScore", GoodScore);
         }
         CancelInvoke();
         Survival sur = FindObjectOfType(typeof(Survival)) as Survival;
         sur.CancelInvoke();
         GameObject b   = Instantiate(EndPanel) as GameObject;
         Canvas     can = FindObjectOfType(typeof(Canvas)) as Canvas;
         b.transform.SetParent(can.transform);
         b.transform.localScale    = new Vector3(1, 1, 1);
         b.transform.localPosition = new Vector3(0, 0, 0);
         ended = true;
     }
 }
Exemplo n.º 3
0
 public static void ReduceUpdateHungerInterval(this Survival survival, float amount)
 {
     survival.kUpdateHungerInterval -= amount;
     survival.CancelInvoke("UpdateHunger");
     survival.InvokeRepeating("UpdateHunger", 0, survival.kUpdateHungerInterval);
 }