Exemplo n.º 1
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.P))
     {
         powerupController.addPowerup(cheatPowerup);
     }
 }
Exemplo n.º 2
0
    /****************************************************************************
     * 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);
        }
    }