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
System.Object
FleeMap
Implements
IMapView<System.Nullable<System.Double>>
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: GoRogue.Pathing
Assembly: GoRogue.dll
Syntax
public class FleeMap : IMapView<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

| Improve this Doc 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.

System.Double magnitude

Magnitude to multiply by during calculation.

Properties

| Improve this Doc View Source

Height

Height of the flee map.

Declaration
public int Height { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

Item[Coord]

Returns the flee-map value for the given position.

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

The position to return the value for.

Property Value
Type Description
System.Nullable<System.Double>

The flee-map value for the given location.

| Improve this Doc View Source

Item[Int32]

Returns the flee-map value for the given position.

Declaration
public double? this[int index1D] { get; }
Parameters
Type Name Description
System.Int32 index1D

The position to return the value for, as a 1D-array-style index.

Property Value
Type Description
System.Nullable<System.Double>

The flee-map value for the given location.

| Improve this Doc View Source

Item[Int32, Int32]

Returns the goal-map value for the given position.

Declaration
public double? this[int x, int y] { get; }
Parameters
Type Name Description
System.Int32 x

The x-value of the position to return the value for.

System.Int32 y

The y-value of the position to return the value for.

Property Value
Type Description
System.Nullable<System.Double>

The flee-map value for the given location.

| Improve this Doc 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
System.Double
| Improve this Doc View Source

Width

Width of the flee map.

Declaration
public int Width { get; }
Property Value
Type Description
System.Int32

Methods

| Improve this Doc View Source

Dispose()

Function called to dispose of the class, automatically unlinking it from its goal map.

Declaration
public void Dispose()
| Improve this Doc View Source

Finalize()

Destructor for IDisposable implementation.

Declaration
protected void Finalize()
| Improve this Doc View Source

GetDirectionOfMinValue(Coord)

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

Declaration
public Direction GetDirectionOfMinValue(Coord position)
Parameters
Type Name Description
Coord 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.

| Improve this Doc View Source

GetDirectionOfMinValue(Int32, Int32)

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
System.Int32 positionX

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

System.Int32 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.

| Improve this Doc View Source

ToString()

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

Declaration
public override string ToString()
Returns
Type Description
System.String

A string representing the flee map values.

Overrides
System.Object.ToString()
| Improve this Doc View Source

ToString(Int32)

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
System.Int32 fieldSize

Number of characters allocated to each value in the string.

Returns
Type Description
System.String

A string representing the flee-map values.

| Improve this Doc View Source

ToString(Int32, 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
System.Int32 fieldSize

Number of characters allocated to each value in the string.

System.String formatString

Format string to use for non-null values.

Returns
Type Description
System.String

A string representing the flee-map values.

| Improve this Doc 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
System.String formatString

Format string to use for non-null values.

Returns
Type Description
System.String

A string representing the flee-map values.

Implements

IMapView<T>
System.IDisposable

Extension Methods

Utility.Yield<T>(T)
IMapViewExtensions.Bounds<T>(IMapView<T>)
IMapViewExtensions.Contains<T>(IMapView<T>, Int32, Int32)
IMapViewExtensions.Contains<T>(IMapView<T>, Coord)
IMapViewExtensions.ExtendToString<T>(IMapView<T>, String, String, Func<T, String>, String, String, String, String)
IMapViewExtensions.ExtendToString<T>(IMapView<T>, Int32, String, String, Func<T, String>, String, String, String, String)
IMapViewExtensions.Positions<T>(IMapView<T>)
IMapViewExtensions.RandomItem<T>(IMapView<T>, IGenerator)
IMapViewExtensions.RandomItem<T>(IMapView<T>, Func<Coord, T, Boolean>, IGenerator)
IMapViewExtensions.RandomPosition<T>(IMapView<T>, T, IGenerator)
IMapViewExtensions.RandomPosition<T>(IMapView<T>, IEnumerable<T>, IGenerator)
IMapViewExtensions.RandomPosition<T>(IMapView<T>, HashSet<T>, IGenerator)
IMapViewExtensions.RandomPosition<T>(IMapView<T>, IGenerator, T[])
IMapViewExtensions.RandomPosition<T>(IMapView<T>, Func<Coord, T, Boolean>, IGenerator)
IMapViewExtensions.RandomPosition<T>(IMapView<T>, IGenerator)
GoalMapExtensions.GetDirectionOfMinValue(IMapView<Nullable<Double>>, Coord, AdjacencyRule)
GoalMapExtensions.GetDirectionOfMinValue(IMapView<Nullable<Double>>, Int32, Int32, AdjacencyRule)
  • Improve this Doc
  • View Source
Back to top Generated by DocFX