Exemple #1
0
 public virtual bool CanMoveTo(int pX, int pY, int pZ, Map map)
 {
     for (int ey = 0; ey < Width; ey++)
     {
         for (int ex = 0; ex < Width; ex++)
         {
             for (int ez = 0; ez < Height; ez++)
             {
                 if (!map.Contains(pX - ex, pY - ey, pZ + ez))
                 {
                     return(false);
                 }
                 Cube c = map.FindCube(pX - ex, pY - ey, pZ + ez);
                 if (c != null && !c.Cross)
                 {
                     return(false);
                 }
                 Entity entity = map.FindEntity(pX - ex, pY - ey, pZ + ez);
                 if (entity != null && !entity.Cross && entity.ID != ID)
                 {
                     return(false);
                 }
             }
         }
     }
     return(true);
 }
Exemple #2
0
 public bool CanBeMovedTo(Map map, ICoordinates cords)
 {
     if (map.Contains(cords))
     {
         ITile tile = map.Matrix[cords.CordY][cords.CordX].Tile;
         return(CanBeMovedTo(tile));
     }
     return(false);
 }