HPASharp.ConcreteMap.GetNodeIdFromPos C# (CSharp) Method

GetNodeIdFromPos() public method

public GetNodeIdFromPos ( int x, int y ) : int
x int
y int
return int
	    public int GetNodeIdFromPos(int x, int y)
	    {
		    return y * Width + x;
	    }

Usage Example

コード例 #1
0
ファイル: Program.cs プロジェクト: i0/HierarchicalPathfinder
        private static List <IPathNode> RegularSearch(ConcreteMap concreteMap, Position startPosition, Position endPosition)
        {
            var tilingGraph = concreteMap.Graph;
            Func <int, int, ConcreteNode> getNode =
                (top, left) => tilingGraph.GetNode(concreteMap.GetNodeIdFromPos(top, left));

            // Regular pathfinding
            var searcher = new AStar <ConcreteNode>(concreteMap, getNode(startPosition.X, startPosition.Y).NodeId, getNode(endPosition.X, endPosition.Y).NodeId);
            var path     = searcher.FindPath();
            var path2    = path.PathNodes;

            return(new List <IPathNode>(path2.Select(p => (IPathNode) new ConcretePathNode(p))));
        }
All Usage Examples Of HPASharp.ConcreteMap::GetNodeIdFromPos