//When the player clicks the mini powerup public virtual void OnMouseDown() { if (this.name == "MiniPower") { PowerupControl.UsePowerup(this.name, 20); //AddScore(); Destroy(this.gameObject); } }
/* Only called when ther is a collision with spaceship and Powerup * 'Uses' the powerup & relocates it */ public virtual void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { //Debug.Log("Collision"); Vector3 SpaceshipPosition = GameObject.Find("Spaceship").transform.position; PowerupControl.UsePowerup(Capsule.tag, scoreToAdd); //Relocate powerup to later in the game (Bigger Z axis number) RelocatePowerup(SpaceshipPosition); } }