public void ShouldGeneratePathBetweenPoints2()
        {
            var origin             = new AxialCoordinate(-2, 2);
            var destination        = new AxialCoordinate(0, 3);
            var expectedPathLength = 3;

            var coordSystem = new HexCoordinateSystem(2);

            var actualPath = coordSystem.GetRouteGenerator(origin, destination)
                             .ToList();

            Assert.AreEqual(expectedPathLength, actualPath.Count);

            foreach (var pair in actualPath.RollingWindow(2))
            {
                var distanceBetween = pair[0].DistanceTo(pair[1]);
                Assert.AreEqual(
                    1,
                    distanceBetween,
                    $"Jump between {pair[0]} and {pair[1]} should have been distance of 1 but was {distanceBetween}");
            }
        }
Exemple #2
0
 public bool IsWithinDistance(ITilemapMember first, ITilemapMember second, int distance)
 {
     //TODO: replace with distance function
     return(!coordinateSystem.GetRouteGenerator(first.PositionInTileMap, second.PositionInTileMap).Skip(distance).Any());
 }