Exemple #1
0
    public void  OnTriggerEnter(Collider c)
    {
        if (isLaunched)
        {
            GameObject    g = c.gameObject;
            ObjectInSpace targetOfCollision = g.GetComponent <ObjectInSpace>();

            while (g.transform.parent && !targetOfCollision)
            {
                g = g.transform.parent.gameObject;
                targetOfCollision = g.GetComponent <ObjectInSpace>();
            }

            if (targetOfCollision)
            {
                if (!(getOwner() != null && targetOfCollision.getOwner() != null && getOwner() == targetOfCollision.getOwner()))
                {
                    ObjectInSpace.DamageReport dmgReport = targetOfCollision.dealDamage(getOwner(), damageDealt, damageType, transform.position);
                    explode();
                }
            }
        }
    }