Exemple #1
0
        public void PathFindingSimplePasses()
        {
            var grid       = new Grid(10, 10);
            var pathFinder = new PathFinder();

            var start = new Point(1, 1);
            var end   = new Point(4, 4);
            var path  = grid.FindPath(pathFinder, start, end);

            Assert.AreEqual(start, path.First());
            Assert.AreEqual(end, path.Last());
        }
Exemple #2
0
    public void Render()
    {
        // Reset color
        foreach (var entry in items)
        {
            entry.Value.SetColor(GridItem.Selected.Nothing);
        }

        foreach (var node in grid.FindPath(pathFinder, from, to))
        {
            GridItem item = null;

            if (!this.items.TryGetValue(node.point, out item))
            {
                throw new Exception("WTF!");
            }

            item.SetColor(GridItem.Selected.Path);
        }
    }