コード例 #1
0
ファイル: MapBuilder.cs プロジェクト: DmitryZyr/CVARC
 private static Direction[,] GetAvailableDirections(StarshipObject[] walls)
 {
     var availableDirections = RemoveDirectionsContactingWithBorder(MapWidth / CellSize + 2, MapHeight / CellSize + 2);
     foreach (var wall in walls)
     {
         if (wall.Type.Contains("Vertical"))
         {
             availableDirections[wall.DiscreteCoordinate.X, wall.DiscreteCoordinate.Y] &= ~Direction.Left;
             availableDirections[wall.DiscreteCoordinate.X - 1, wall.DiscreteCoordinate.Y] &= ~Direction.Right;
         }
         else if (wall.Type.Contains("Horizontal"))
         {
             availableDirections[wall.DiscreteCoordinate.X, wall.DiscreteCoordinate.Y] &= ~Direction.Up;
             availableDirections[wall.DiscreteCoordinate.X, wall.DiscreteCoordinate.Y - 1] &= ~Direction.Down;
         }
     }
     return availableDirections;
 }
コード例 #2
0
ファイル: Azura.cs プロジェクト: DmitryZyr/CVARC
 private int GetDistance(StarshipObject starshipObject)
 {
     var objCoordinates = starshipObject.DiscreteCoordinate;
     return Math.Abs(OurCoordinates.X - objCoordinates.X) + Math.Abs(OurCoordinates.Y - objCoordinates.Y);
 }