예제 #1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "MainCamera")
     {
         // collision is with the player.
         // get the player interface
         DronePlayer player = other.GetComponent(typeof(DronePlayer)) as DronePlayer;
         if (player != null)
         {
             PowerUpObject obj = (this.gameObject.GetComponent(typeof(PowerUpObject)) as PowerUpObject);
             if (obj != null)
             {
                 obj.performPowerupOnPlayer(player);
             }
         }
         Destroy(gameObject);
     }
 }
예제 #2
0
 void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag == "player")
     {
         // collision is with the player.
         // get the player interface
         DronePlayer player = collision.gameObject.GetComponent(typeof(DronePlayer)) as DronePlayer;
         if (player != null)
         {
             PowerUpObject obj = (this.gameObject.GetComponent(typeof(PowerUpObject)) as PowerUpObject);
             if (obj != null)
             {
                 obj.performPowerupOnPlayer(player);
             }
         }
         Destroy(gameObject);
     }
 }