// 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(); }
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()); } } }