Exemple #1
0
    void CheckExplosion(Vector3 direction)
    {
        RaycastHit hit;

        if (Physics.Raycast(transform.position, direction, out hit))
        {
            if (hit.distance <= currentWidth)
            {
                Mole hitMole = hit.transform.gameObject.GetComponent <Mole>();
                if (hitMole)
                {
                    hitMole.Die(hitMole.allowChainReaction);
                }
            }
        }
    }
Exemple #2
0
 void HitWithinRange(GridSpawner gridSpawner)
 {
     for (int x = posX - radius; x <= posX + radius; x++)
     {
         for (int y = posY - radius; y <= posY + radius; y++)
         {
             GameObject obj = gridSpawner.LookupGrid(x, y);
             if (obj)
             {
                 Mole mole = obj.GetComponent <Mole>();
                 if (true)
                 {
                     mole.Die();
                 }
             }
         }
     }
 }