Example #1
0
    private void OnCollisionEnter(Collision collision)
    {
        Damageable damageable;

        if (collision.gameObject.TryGetComponent <Damageable>(out damageable))
        {
            damageable.TakeDamage(damage, () => castleShipRef.AddKills(1));
        }
        Remove();
    }
Example #2
0
    private void OnTriggerEnter(Collider other)
    {
        Damageable damageable;

        if (other.gameObject.TryGetComponent <Damageable>(out damageable))
        {
            if (other.gameObject == castleShip.gameObject)
            {
                return;
            }
            damageable.TakeDamage(damage, () => castleShip.AddKills(1));
            Remove();
        }
    }