Пример #1
0
        public List<Vector2> FindPath(PolyLink Start, PolyLink End)
        {
            List<PolyLink> searched;

            PolyLink currentNode = Start;
            throw new NotImplementedException();
        }
Пример #2
0
        public void BoardLink1()
        {
            Logger.Open(1);
            var input = new StringReader(
                @"(include ""testincl.poly"")" +
                @"(game (gamestub1)" +
                @"(board (boardlink1)) )");
            var game = PolyGame.CreateInner("bt2", input);

            Assert.AreEqual(1, game.Menu.Count());
            Assert.AreEqual("stub1", game.Title);
            Assert.AreEqual("board1.png", game.BoardImages[0]);

            var positions = new PolyPosition[] {
                new PolyPosition {
                    Name = "a1", Location = Rect.Create(11, 12, 13, 14), IsDummy = false,
                },
                new PolyPosition {
                    Name = "a2", Location = Rect.Create(21, 22, 23, 24), IsDummy = false,
                },
                new PolyPosition {
                    Name = "b1", Location = Rect.Create(31, 32, 33, 34), IsDummy = false,
                },
                new PolyPosition {
                    Name = "b2", Location = Rect.Create(41, 42, 43, 44), IsDummy = false,
                },
            };

            CollectionAssert.AreEquivalent(positions, game.Positions.ToArray());

            var links = new PolyLink[] {
                new PolyLink {
                    Direction = "n", From = "a2", To = "a1"
                },
                new PolyLink {
                    Direction = "e", From = "a1", To = "b1"
                },
            };

            CollectionAssert.AreEquivalent(links, game.Links.ToArray());

            var zones = new PolyZone[] {
                new PolyZone {
                    Name = "zone1", Player = "X", Positions = "a1 a2"
                },
            };

            CollectionAssert.AreEquivalent(zones, game.Zones.ToArray());
        }
Пример #3
0
 private static int GetCost(PolyLink a, PolyLink b)
 {
     return (int) Vector2.Distance (a.GetVertex(), b.GetVertex());
 }