예제 #1
0
    // Use this for initialization

    void Awake()
    {
        highScore              = PlayerPrefs.GetInt("highScore", 0);
        shieldCount            = PlayerPrefs.GetInt("shieldCount", 99);
        asteroidCount          = PlayerPrefs.GetInt("asteroidCount", 99);
        shieldCountText.text   = ShieldCount.ToString();
        asteroidCountText.text = AsteroidCount.ToString();
    }
예제 #2
0
 public void OnShield()
 {
     if (shieldCount > 0)
     {
         shieldCount--;
         PlayerPrefs.SetInt("shieldCount", shieldCount);
         shieldCountText.text = ShieldCount.ToString();
         if (!shield.activeInHierarchy)
         {
             shield.SetActive(true);
         }
         shieldActiveTime += shieldDefaultTime;
         if (shieldActiveTime <= shieldDefaultTime)
         {
             StartCoroutine(shieldProtect());
         }
     }
 }