private UnitModel ShootingTarget(BattlefieldVision vision)
 {
     for (int i = 1; i <= _maxShootingDistance; i++)
     {
         var pos = new MyHexPosition(i, 0);
         if (!vision.HasTileAt(pos))
         {
             return(null);
         }
         var otherUnitAtFront = vision.GetUnitAt(pos);
         if (otherUnitAtFront != null)
         {
             if (otherUnitAtFront.Owner != vision.PossesedPawn.Owner)
             {
                 return(otherUnitAtFront);
             }
             else
             {
                 return(null);
             }
         }
     }
     return(null);
 }
Ejemplo n.º 2
0
 private UnitModel RetriveGrabbedUnit(BattlefieldVision vision)
 {
     for (int i = MinDragDistance; i <= MaxDragDistance; i++)
     {
         var pos = new MyHexPosition(i, 0);
         if (!vision.HasTileAt(pos))
         {
             return(null);
         }
         var otherUnitAtFront = vision.GetUnitAt(pos);
         if (otherUnitAtFront != null)
         {
             if (otherUnitAtFront.Owner != vision.PossesedPawn.Owner)
             {
                 return(otherUnitAtFront);
             }
             else
             {
                 return(null);
             }
         }
     }
     return(null);
 }