Beispiel #1
0
 private void BulletHit(Collider2D collision)
 {
     if (collision.gameObject.layer != ignoreLayer)
     {
         Destroyable destroyableObject = collision.GetComponent <Destroyable>();
         if (destroyableObject != null)
         {
             destroyableObject.ApplyDamage(damage);
         }
         bulletPool.AddToPool(gameObject);
     }
 }
    public void OnHitDestroyable(Destroyable item)
    {
        if (item.gameObject == gameObject)
        {
            return;
        }

        AudioManager.instance.RandomizeSfx(Sounds);
        item.ApplyDamage(Damage);
        if (item.KnockbackEnabled && KnockbackZone != null)
        {
            StartCoroutine(ApplyKnockback());
        }
    }