Interface IGoalMap
An interface for classes that assign weights to every cell on the Map and then use this for finding paths or building desire-driven AI
Namespace: RogueSharp
Assembly: RogueSharp.dll
Syntax
public interface IGoalMap
Methods
| Improve this Doc View SourceAddGoal(Int32, Int32, Int32)
Add a Goal at the specified location with the specified weight
Declaration
void AddGoal(int x, int y, int weight)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | X location of the Goal starting with 0 as the farthest left |
System.Int32 | y | Y location of the Goal starting with 0 as the top |
System.Int32 | weight | The priority of this goal with respect to other goals with lower numbers being a higher priority |
AddObstacle(Int32, Int32)
Add an Obstacle at the specified location. Any paths found must not go through Obstacles
Declaration
void AddObstacle(int x, int y)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | X location of the Obstacle starting with 0 as the farthest left |
System.Int32 | y | Y location of the Obstacle starting with 0 as the top |
AddObstacles(IEnumerable<Point>)
Add multiple obstacles from the specified enumeration of locations
Declaration
void AddObstacles(IEnumerable<Point> obstacles)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<Point> | obstacles | An enumeration of points representing X, Y locations of Obstacles to avoid when path-finding |
ClearGoals()
Remove all goals from this GoalMap
Declaration
void ClearGoals()
ClearObstacles()
Remove all Obstacles from this GoalMap
Declaration
void ClearObstacles()
FindPath(Int32, Int32)
Returns a shortest Path representing an ordered List of Points from the specified location to the Goal determined to have the highest priority Distance to the goals and the weight of the goals are both used in determining the priority The path must not pass through any obstacles specified in this GoalMap instance
Declaration
Path FindPath(int x, int y)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | X location of the beginning of the path, starting with 0 as the farthest left |
System.Int32 | y | Y location of the beginning of the path, starting with 0 as the top |
Returns
Type | Description |
---|---|
Path | An ordered List of Points representing a shortest path from the specified location to the Goal determined to have the highest priority |
FindPathAvoidingGoals(Int32, Int32)
Returns a Path representing an ordered list of Points from the specified location away from Goals specified in this GoalMap instance Distance to the goals and the weight of the goals are both used in determining the priority of avoiding the Goals The path must not pass through any Obstacles specified in this GoalMap instance
Declaration
Path FindPathAvoidingGoals(int x, int y)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | X location of the beginning of the path, starting with 0 as the farthest left |
System.Int32 | y | Y location of the beginning of the path, starting with 0 as the top |
Returns
Type | Description |
---|---|
Path | A Path representing ordered List of Points from the specified location away from Goals and avoiding Obstacles |
FindPaths(Int32, Int32)
Returns a ReadOnlyCollection of Paths representing all of the shortest paths from the specified location to the Goal or Goals determined to have the highest priority This method is useful when there are multiple paths that would all work and we want to have some additional logic to pick one of the best paths The FindPath( int x, int y ) method in the GoalMap class uses this method and then chooses the first path.
Declaration
ReadOnlyCollection<Path> FindPaths(int x, int y)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | X location of the beginning of the path, starting with 0 as the farthest left |
System.Int32 | y | Y location of the beginning of the path, starting with 0 as the top |
Returns
Type | Description |
---|---|
System.Collections.ObjectModel.ReadOnlyCollection<Path> | A ReadOnlyCollection of Paths representing all of the shortest paths from the specified location to the Goal or Goals determined to have the highest priority |
RemoveGoal(Int32, Int32)
Remove a Goal at the specified location
Declaration
void RemoveGoal(int x, int y)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | X location of the Goal starting with 0 as the farthest left |
System.Int32 | y | Y location of the Goal starting with 0 as the top |
RemoveObstacle(Int32, Int32)
Remove an Obstacle at the specified location
Declaration
void RemoveObstacle(int x, int y)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | X location of the Obstacle starting with 0 as the farthest left |
System.Int32 | y | Y location of the Obstacle starting with 0 as the top |
TryFindPath(Int32, Int32)
Returns a shortest Path representing an ordered List of Points from the specified location to the Goal determined to have the highest priority Distance to the goals and the weight of the goals are both used in determining the priority The path must not pass through any obstacles specified in this GoalMap instance null will be returned if a path cannot be found
Declaration
Path TryFindPath(int x, int y)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | X location of the beginning of the path, starting with 0 as the farthest left |
System.Int32 | y | Y location of the beginning of the path, starting with 0 as the top |
Returns
Type | Description |
---|---|
Path | An ordered List of Points representing a shortest path from the specified location to the Goal determined to have the highest priority. null is returned if a path cannot be found |
TryFindPathAvoidingGoals(Int32, Int32)
Returns a Path representing an ordered list of Points from the specified location away from Goals specified in this GoalMap instance Distance to the goals and the weight of the goals are both used in determining the priority of avoiding the Goals The path must not pass through any Obstacles specified in this GoalMap instance Returns null if a Path is not found
Declaration
Path TryFindPathAvoidingGoals(int x, int y)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | X location of the beginning of the path, starting with 0 as the farthest left |
System.Int32 | y | Y location of the beginning of the path, starting with 0 as the top |
Returns
Type | Description |
---|---|
Path | A Path representing ordered List of Points from the specified location away from Goals and avoiding Obstacles. Returns null if a Path is not found |
TryFindPaths(Int32, Int32)
Returns a ReadOnlyCollection of Paths representing all of the shortest paths from the specified location to the Goal or Goals determined to have the highest priority This method is useful when there are multiple paths that would all work and we want to have some additional logic to pick one of the best paths The FindPath( int x, int y ) method in the GoalMap class uses this method and then chooses the first path.
Declaration
ReadOnlyCollection<Path> TryFindPaths(int x, int y)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | X location of the beginning of the path, starting with 0 as the farthest left |
System.Int32 | y | Y location of the beginning of the path, starting with 0 as the top |
Returns
Type | Description |
---|---|
System.Collections.ObjectModel.ReadOnlyCollection<Path> | A ReadOnlyCollection of Paths representing all of the shortest paths from the specified location to the Goal or Goals determined to have the highest priority. Returns null if no path is found. |