Exemplo n.º 1
0
 void OnTriggerEnter2D(Collider2D coll)
 {
     // The following destroys This trap if a newer one is laid on top
     Debug.Log("entered trigger - TRAP");
     if (coll.gameObject.tag == "Trap" || coll.gameObject.tag == "ProjectileTrap")         //if a trap is laid over this one
     {
         //Debug.Log ("this trigger is a trap!");
         Trap tc = coll.gameObject.GetComponent <Trap>();
         if (age <= tc.GetAge())              //if this is the trap laid down second - prioritize the original
         {
             Destroy(this.gameObject);
         }
     }
     else if (coll.gameObject.tag == "Bullet")
     {
         Bullet bc = coll.gameObject.GetComponent <Bullet>();
         if (bc.comboKey > 0f || comboKey > 0f)
         {
             //TODO - chance/odds of the following happening?
             //Bullet hitting Trap combo effect
             BulletTrapComboEffects(bc);
         }
     }
 }