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 SpeedUpActive(float duration) { cc.m_moveSpeed *= 2; BoostTrail.SetActive(true); SpeedBoostUI.SetActive(false); //Debug.Log("speed up"); yield return(new WaitForSeconds(duration)); //Debug.Log("speed down"); AudioController.Instance.PlaySpeedBoostDeActiveAudio(); cc.m_moveSpeed /= 2; BoostTrail.SetActive(false); hasSpeedUp = false; hasPowerUp = false; }