void Update() { if (Input.GetKeyDown(KeyCode.P)) { powerupController.addPowerup(cheatPowerup); } }
/**************************************************************************** * OnTriggerEnter */ /** ****************************************************************************/ void OnTriggerEnter(Collider other) { /** Powerup Controller of Collider object. */ PowerupController pc = other.GetComponent <PowerupController>(); /** Add the powerup if there is a Powerup Controller. */ if (pc != null) { /** Play feedback audio. */ AudioSource.PlayClipAtPoint(feedback, gameObject.transform.position); /** Add the powerup. */ pc.addPowerup(powerup); /** Set hidden. */ isAlive = false; /** Deactivate spawner. */ gameObject.transform.position = new Vector3(1000, 1000, 1000); } }