예제 #1
0
 protected void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Level")
     {
         SelfDestruct();
     }
     else if (collision.tag == "Enemy" || collision.tag == "Player")     // pour friendly fire
     // immune owner
     {
         if (shooter == null || collision.gameObject.GetInstanceID() != shooter.GetInstanceID())
         {
             CharacterEngine character = collision.gameObject.GetComponent <CharacterEngine>();
             // hpLoss + self destroy
             if (character != null && character.Damage(damage * BUFF))
             {
                 SelfDestruct();
             }
         }
     }
 }