Пример #1
0
 void OnTriggerEnter2D (Collider2D coll) {
     foreach (string tag in targetedTags) {
         if (coll.gameObject.tag == tag) {
             IDamageable d = coll.GetComponent<IDamageable> ();
             if (d != null && d.IsDamageable) {
                 Damage (d);
                 if (destructible != null) destructible.Destroy (null);
             }
             break;
         }
     }
 }
Пример #2
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (!isCollected)
     {
         if (collision.CompareTag("Player"))
         {
             playerCollectables.IncreaseKeysAmount(1);
             OnCollection.Raise();
             if (destructible != null)
             {
                 destructible.Destroy(transform);
             }
             isCollected = true;
         }
     }
 }
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (!isCollected)
        {
            if (collision.CompareTag("Player"))
            {
                if (playerStats.currentHP < playerStats.maxHP)
                {
                    playerStats.currentHP++;

                    OnCollection.Raise();
                    if (destructible != null)
                    {
                        destructible.Destroy(transform);
                    }
                    isCollected = true;
                }
            }
        }
    }
Пример #4
0
 static void invocation(IDestructible destructible) => destructible.Destroy();
Пример #5
0
 void DestroyProjectile()
 {
     destructible.Destroy(null);
 }