Exemplo n.º 1
0
 public void SetPathOverlay(int Index, TilePathOverlay PathOverlay)
 {
     Configuration.SetPathOverlay(Index, PathOverlay);
     if (NeighborTiles[Index] != null &&
         NeighborTiles[Index].Configuration.GetPathOverlay((Index + 3) % 6) != PathOverlay)
     {
         NeighborTiles[Index].SetPathOverlay((Index + 3) % 6, PathOverlay);
     }
 }
Exemplo n.º 2
0
        void MakePath(Tile Start, Tile End, TilePathOverlay Path, Func <Tile, Tile, double> DistanceFunction)
        {
            var path = new Path <Tile>(
                Start,
                End,
                i => true,
                DistanceFunction,
                (i, j) => i.HeuristicDistanceTo(j),
                i => i.Neighbors(),
                (i, j) => i == j);

            for (int i = 0; i < path.Count - 1; ++i)
            {
                path[i].SetPathOverlay(Array.IndexOf(path[i].NeighborTiles, path[i + 1]), Path);
            }
        }
Exemplo n.º 3
0
 Tuple <int, int> GetDisconntedNeighbor(TilePathOverlay Overlay)
 {
     for (int i = 0; i < 6; ++i)
     {
         for (int j = 0; j < 6; ++j)
         {
             if (NeighborTiles[i].Configuration.GetPathOverlay(j) == Overlay &&
                 NeighborTiles[i].NeighborTiles[j].Configuration.GetPathOverlay(
                     (j + 3) % 6) == TilePathOverlay.NONE)
             {
                 return(new Tuple <int, int>(i, j));
             }
         }
     }
     return(null);
 }
Exemplo n.º 4
0
 void EdgePathOverlay(Tile Tile, TilePathOverlay Path)
 {
     if (Tile.OnEdge(Direction.NORTH))
     {
         Tile.SetPathOverlay(2, Path);
     }
     else if (Tile.OnEdge(Direction.SOUTH))
     {
         Tile.SetPathOverlay(4, Path);
     }
     else if (Tile.OnEdge(Direction.WEST))
     {
         Tile.SetPathOverlay(0, Path);
     }
     else if (Tile.OnEdge(Direction.EAST))
     {
         Tile.SetPathOverlay(3, Path);
     }
 }
 public void SetPathOverlay(int Index, TilePathOverlay PathOverlay)
 {
     _PathOverlays[Index] = PathOverlay;
     TriggerReconfigure();
 }
 public bool HasPathOverlay(TilePathOverlay PathOverlay)
 {
     return(_PathOverlays.Any(i => i == PathOverlay));
 }
Exemplo n.º 7
0
        public TileHasPath(ParseBlock Block)
        {
            var attributes = Block.BreakToAttributes <object>(typeof(Attribute));

            Path = (TilePathOverlay)attributes[(int)Attribute.PATH];
        }
Exemplo n.º 8
0
 public TileHasPath(TilePathOverlay Path)
 {
     this.Path = Path;
 }
Exemplo n.º 9
0
 float PathBorderWidth(TilePathOverlay PathOverlay)
 {
     return(_PathBorderWidths[(int)PathOverlay]);
 }
Exemplo n.º 10
0
 Color PathBorderColor(TilePathOverlay PathOverlay)
 {
     return(_PathBorderColors[(int)PathOverlay]);
 }
Exemplo n.º 11
0
 public TileComponentRules GetRules(TilePathOverlay Type)
 {
     return(_PathOverlayRules[(int)Type]);
 }