コード例 #1
0
        public void PathRotatesCorrectly(int rotation, double expectedX, double expectedY)
        {
            var random = new Random(123123);

            for (var i = 0; i < 100; i++)
            {
                var gridX = random.Next(World.MinGridPosition.X, World.MaxGridPosition.X);
                var gridY = random.Next(World.MinGridPosition.Y, World.MaxGridPosition.Y);

                var world = new World(TileType.GetTileTypes(), new DateTime());

                var tile = world.CreateFromName("depot", new Int2(gridX, gridY), rotation);
                var size = world.GetTileSize(tile);
                var path = world.GetGridPath(tile);

                Assert.AreEqual(gridX + expectedX, path(0).X, 0.01);
                Assert.AreEqual(gridY + expectedY, path(0).Y, 0.01);
            }
        }