Show / Hide Table of Contents

Class FleeMap

Implements the concept of a "safety map", also known as "flee map", as described in the this article.

Inheritance
object
GridViewBase<double?>
FleeMap
Implements
IGridView<double?>
IDisposable
Inherited Members
GridViewBase<double?>.Count
GridViewBase<double?>.this[int, int]
GridViewBase<double?>.this[int]
object.GetType()
object.MemberwiseClone()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: GoRogue.Pathing
Assembly: GoRogue.dll
Syntax
public class FleeMap : GridViewBase<double?>, IGridView<double?>, IDisposable
Remarks

Takes a goal map, wherein any goals are treated as "threats" to be avoided. Automatically recalculated when the underlying goal map is recalculated. Implements IDisposable, so ensure that it is disposed of properly after use.

Constructors

View Source

FleeMap(GoalMap, double)

Constructor. Takes a goal map where in all goals are treated as threats to be avoided, and a magnitude to use (defaulting to 1.2).

Declaration
public FleeMap(GoalMap baseMap, double magnitude = 1.2)
Parameters
Type Name Description
GoalMap baseMap

The underlying goal map to use.

double magnitude

Magnitude to multiply by during calculation.

Properties

View Source

Height

Height of the flee map.

Declaration
public override int Height { get; }
Property Value
Type Description
int
Overrides
SadRogue.Primitives.GridViews.GridViewBase<double?>.Height
View Source

this[Point]

Returns the flee-map value for the given position.

Declaration
public override double? this[Point pos] { get; }
Parameters
Type Name Description
Point pos

The position to return the value for.

Property Value
Type Description
double?

The flee-map value for the given location.

Overrides
SadRogue.Primitives.GridViews.GridViewBase<double?>.this[SadRogue.Primitives.Point]
View Source

Magnitude

The degree to which entities following this flee-map will prefer global safety to local safety. Higher values will make entities try to move past an approaching "threat" from farther away.

Declaration
public double Magnitude { get; set; }
Property Value
Type Description
double
View Source

Width

Width of the flee map.

Declaration
public override int Width { get; }
Property Value
Type Description
int
Overrides
SadRogue.Primitives.GridViews.GridViewBase<double?>.Width

Methods

View Source

Dispose()

Function called to dispose of the class, automatically un-linking it from its goal map.

Declaration
public void Dispose()
View Source

~FleeMap()

Destructor for IDisposable implementation.

Declaration
protected ~FleeMap()
View Source

GetDirectionOfMinValue(Point)

Gets the direction of the neighbor with the minimum flee-map value from the given position.

Declaration
public Direction GetDirectionOfMinValue(Point position)
Parameters
Type Name Description
Point position

The position to get the minimum value for.

Returns
Type Description
Direction

The direction that has the minimum value in the goal-map, or None if the neighbors are all obstacles.

View Source

GetDirectionOfMinValue(int, int)

Gets the direction of the neighbor with the minimum flee-map value from the given position.

Declaration
public Direction GetDirectionOfMinValue(int positionX, int positionY)
Parameters
Type Name Description
int positionX

The x-value of the position to get the minimum value for.

int positionY

The y-value of the position to get the minimum value for.

Returns
Type Description
Direction

The direction that has the minimum value in the goal-map, or None if the neighbors are all obstacles.

View Source

ToString()

Returns the flee-map values represented as a 2D grid-style string.

Declaration
public override string ToString()
Returns
Type Description
string

A string representing the flee map values.

Overrides
object.ToString()
View Source

ToString(int)

Returns the flee-map values represented as a 2D-grid-style string, with the given field size.

Declaration
public string ToString(int fieldSize)
Parameters
Type Name Description
int fieldSize

Number of characters allocated to each value in the string.

Returns
Type Description
string

A string representing the flee-map values.

View Source

ToString(int, string)

Returns the flee-map values represented as a 2D-grid-style string, with the given field size, and any non-null values formatted using the given format string.

Declaration
public string ToString(int fieldSize, string formatString)
Parameters
Type Name Description
int fieldSize

Number of characters allocated to each value in the string.

string formatString

Format string to use for non-null values.

Returns
Type Description
string

A string representing the flee-map values.

View Source

ToString(string)

Returns the flee-map values represented as a 2D-grid-style string, where any value that isn't null is formatted as per the specified format string.

Declaration
public string ToString(string formatString)
Parameters
Type Name Description
string formatString

Format string to use for non-null values.

Returns
Type Description
string

A string representing the flee-map values.

Implements

IGridView<T>
IDisposable

Extension Methods

Utility.Yield<T>(T)
GoalMapExtensions.GetDirectionOfMinValue(IGridView<double?>, Point, AdjacencyRule)
GoalMapExtensions.GetDirectionOfMinValue(IGridView<double?>, int, int, AdjacencyRule)
  • View Source
In this article
Back to top Generated by DocFX