Esempio n. 1
0
    private void OnTriggerEnter(Collider other)
    {
        Hitable hit       = other.GetComponent <Hitable>();
        bool    canDamage = true;

        if (hit)
        {
            if (cantDamage.Count > 0)
            {
                foreach (Hitable alreadyHit in cantDamage)
                {
                    if (hit == alreadyHit)
                    {
                        canDamage = false;
                    }
                }
            }

            if (canDamage)
            {
                hit.HitMe(dmg, teamNo, true);
                cantDamage.Add(hit);
            }
        }
    }