Ignore:
Timestamp:
2015-06-09 21:12:52 (4 years ago)
Author:
sieerinn
Message:

Reitinlöytö toimii.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 2015/24/ohjaajat/Dungeon/Dungeon/Dungeon/Pathfinding/PathFinder.cs

    r5967 r5969  
    1616        private Node endNode; 
    1717        private SearchParameters searchParameters; 
     18        private Func<Point, Point, bool> extraCheck; 
    1819 
    1920        /// <summary> 
     
    2122        /// </summary> 
    2223        /// <param name="searchParameters"></param> 
    23         public PathFinder(SearchParameters searchParameters) 
     24        public PathFinder(SearchParameters searchParameters, Func<Point, Point, bool> extraCheck) 
    2425        { 
     26            this.extraCheck = extraCheck; 
    2527            this.searchParameters = searchParameters; 
    2628            InitializeNodes(searchParameters.Map); 
     
    134136                    continue; 
    135137 
     138                if (!extraCheck(fromNode.Location, location)) 
     139                    continue; 
     140 
    136141                // Already-open nodes are only added to the list if their G-value is lower going via this route. 
    137142                if (node.State == NodeState.Open) 
     
    166171            return new Point[] 
    167172            { 
    168                 new Point(fromLocation.X-1, fromLocation.Y-1), 
     173                //new Point(fromLocation.X-1, fromLocation.Y-1), 
    169174                new Point(fromLocation.X-1, fromLocation.Y  ), 
    170                 new Point(fromLocation.X-1, fromLocation.Y+1), 
     175                //new Point(fromLocation.X-1, fromLocation.Y+1), 
    171176                new Point(fromLocation.X,   fromLocation.Y+1), 
    172                 new Point(fromLocation.X+1, fromLocation.Y+1), 
     177                //new Point(fromLocation.X+1, fromLocation.Y+1), 
    173178                new Point(fromLocation.X+1, fromLocation.Y  ), 
    174                 new Point(fromLocation.X+1, fromLocation.Y-1), 
     179                //new Point(fromLocation.X+1, fromLocation.Y-1), 
    175180                new Point(fromLocation.X,   fromLocation.Y-1) 
    176181            }; 
Note: See TracChangeset for help on using the changeset viewer.