Beispiel #1
0
 /**
  * Will select Enemies within the current Enemy Set that would be affected by the light
  * @param targetSet The current Enemy Set
  * @param currentCollumn the Collumn within the Set that the light is on
  */
 public void selectTargetableEnemies(EnemySet targetSet, int currentCollumn)
 {
     if (targetSet != null)
     {
         BaseEnemy currentTarget = null;
         //Reveal
         if (type == BeamType.REVEAL)
         {
             for (int loop = currentCollumn - 1; loop <= currentCollumn + 1 && loop < targetSet.getNumberOfCollumns(); loop++)
             {
                 currentTarget = getClosestEnemy(targetSet, loop);
                 if (currentTarget != null)
                 {
                     currentTarget.select();
                 }
             }
         }
         //Wide
         else if (type == BeamType.WIDE)
         {
             for (int loop = currentCollumn - 2; loop <= currentCollumn + 2 && loop < targetSet.getNumberOfCollumns(); loop++)
             {
                 currentTarget = getClosestEnemy(targetSet, loop);
                 if (currentTarget != null)
                 {
                     currentTarget.select();
                 }
             }
         }
         //Laser
         else
         {
             for (int loopRow = 0; loopRow < targetSet.getNumberOfRows(); loopRow++)
             {
                 currentTarget = targetSet.getEnemyAt(loopRow, currentCollumn);
                 if (currentTarget != null)
                 {
                     currentTarget.select();
                 }
             }
         }
     }
 }