private void OnTriggerEnter(Collider other) { if (!hasPowerUp) { if (other.tag.Equals("Shield")) { AudioController.Instance.PlayShieldBoostPickUpAudio(); ShieldUI.SetActive(true); Destroy(other.gameObject); hasShield = true; hasPowerUp = true; //powerUpSpot.hasSpawn = false; //SpeedUpSpot.hasSpawn = false; } if (other.tag.Equals("SpeedUp")) { AudioController.Instance.PlaySpeedBoostPickUpAudio(); SpeedBoostUI.SetActive(true); Destroy(other.gameObject); hasSpeedUp = true; hasPowerUp = true; //powerUpSpot.hasSpawn = false; //SpeedUpSpot.hasSpawn = false; } if (other.tag.Equals("Multiplier")) { AudioController.Instance.PlayCheeseAudio(); MultiplierUI.SetActive(true); Destroy(other.gameObject); hasMultiplier = true; hasPowerUp = true; } } }
IEnumerator ShieldActive(float duration) { shield.SetActive(true); shieldIsUp = true; ShieldUI.SetActive(false); yield return(new WaitForSeconds(duration)); AudioController.Instance.PlayShieldDeActiveAudio(); shield.SetActive(false); hasShield = false; hasPowerUp = false; shieldIsUp = false; }