Exemplo n.º 1
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (used)
        {
            return;
        }

        Bullet otherBullet = other.GetComponent <Bullet>();

        if (otherBullet != null)
        {
            if (otherBullet.owner != this.owner)
            {
                otherBullet.Destroy();
                this.Destroy();
            }
            return;
        }

        ShipPart shipPart = other.GetComponent <ShipPart>();

        if (shipPart != null)
        {
            if (shipPart.shipController != this.owner)
            {
                shipPart.Hit();
                used = true;
                this.Destroy();
            }
            return;
        }
    }