예제 #1
0
 public void SaveLife()
 {
     SaveLifePanel.SetActive(false);
     ProtectedPrefs.SetInt("mLamp", lCount - 1);
     Controller.iDie = false;
     SaveMe          = true;
     lifesave        = false;
     GetLamp();
     MainMenuPanel.SetActive(true);
     timerl        = 0;
     sl.fillAmount = 1;
 }
예제 #2
0
    void Update()
    {
        if (lifesave == true && Controller.iDie && !loadS && !SaveMe)
        {
            showAd = false;
            SaveLifePanel.SetActive(true);
            timerl        += Time.deltaTime;
            sl.fillAmount -= Time.deltaTime / 1.8F;
            if (timerl >= 1.8F)
            {
                timerl        = 0;
                sl.fillAmount = 1;
                SaveLifePanel.SetActive(false);
                Invoke("GameOver", 0.5f);
                loadS = true;
            }
        }

        if (itemAbsorb.getLamp)
        {
            GetLamp();
        }
        coine.text    = coin.ToString();
        distance.text = Controller.Distance.ToString("00000000") + "0";
        if (Controller.Distance > 10 && Controller.Distance > ProtectedPrefs.GetFloat("HighScore") && !changeScorecolor)
        {
            cc += Time.deltaTime;
            if (cc < 1)
            {
                distance.color = new Color(1, 0, 0, 1);
            }
            else if (cc > 1 && cc < 1.5f)
            {
                distance.color = new Color(1, 1, 1, 1);
            }
            else if (cc > 1.5f && cc < 2)
            {
                distance.color = new Color(1, 0, 0, 1);
            }
            else if (cc > 2 && cc < 2.5f)
            {
                distance.color = new Color(1, 1, 1, 1);
            }
            else if (cc > 2.5f)
            {
                distance.color   = new Color(1f, 0.92f, 0.016f, 1f);
                cc               = 0;
                changeScorecolor = true;
            }
        }
        if (Controller.iDie && ProtectedPrefs.GetInt("mLamp") < 1)
        {
            MainMenuPanel.SetActive(false);
            Invoke("GameOver", 0.5f);
        }
        else if (Controller.iDie && ProtectedPrefs.GetInt("mLamp") > 0 && !lifesave)
        {
            MainMenuPanel.SetActive(false);
            lifesave = true;
            loadS    = false;
        }
    }