예제 #1
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (Game1 game = new Game1())
     {
         game.Run();
     }
 }
예제 #2
0
 static void Main()
 {
     using (var game = new Game1())
         game.Run();
 }
        public void Search(Node origin, Node goal, ref Grid grid, Game1 game, ref Tree[] allTrees, ref List<Node> _path)
        {
            this.path = _path;
            this.game = game;

            allNodes.Clear();

            ResetNodes();

            this.origin = origin;
            this._squares = grid.nodes;
            this.row = grid.Rows;
            this.column = grid.Columns;

            foreach (Point p in GetPoints())
            {
                allNodes.Add(_squares[p.X,p.Y]);
                _squares[p.X, p.Y].ChangeTexture(ImageLibrary.getInstance().getImage("Floor"));
            }

            allNodes.Remove(goal);
            allNodes.Remove(origin);

            foreach (Node tree in SortTrees(6))
            {
                tree.state = nodeState.CLOSED;
            }

            goal.state = nodeState.GOAL;
            origin.state = nodeState.ORIGIN;

            Pathfind();
            DrawPath(goal,ref grid,ref allTrees);
        }