示例#1
0
        static Tile[] FindLOS(Map Map, HexCoordinate From, HexCoordinate To, bool Dither)
        {
            var count = From.Distance(To);
            var tiles = new Tile[count + 1];
            var step  = 1.0 / count;

            for (int i = 0; i < count + 1; ++i)
            {
                Coordinate c = HexCoordinate.Interpolate(From, To, step * i, Dither ? -.01 : 0).ToCoordinate();
                if (c.X < 0 || c.X >= Map.Tiles.GetLength(0) || c.Y < 0 || c.Y >= Map.Tiles.GetLength(1))
                {
                    return(null);
                }
                tiles[i] = Map.Tiles[c.X, c.Y];
            }
            return(tiles);
        }
示例#2
0
 public double HeuristicDistanceTo(Tile Node)
 {
     return(.49 * HexCoordinate.Distance(Node.HexCoordinate));
 }