DirectionHelper

Namespace: Murder.Helpers
Assembly: Murder.dll

public static class DirectionHelper

⭐ Properties

Cardinal4

public static ImmutableArray<T> Cardinal4;

Returns
ImmutableArray<T>

Cardinal4Flipped

public static ImmutableArray<T> Cardinal4Flipped;

Returns
ImmutableArray<T>

Cardinal8

public static ImmutableArray<T> Cardinal8;

Returns
ImmutableArray<T>

Cardinal8Flipped

public static ImmutableArray<T> Cardinal8Flipped;

Returns
ImmutableArray<T>

⭐ Methods

Flipped(Direction)

public bool Flipped(Direction direction)

Parameters
direction Direction

Returns
bool

FromAngle(float)

public Direction FromAngle(float angle)

Converts an angle (in radians) to a Direction enum.

Parameters
angle float

Returns
Direction

FromVector(Vector2)

public Direction FromVector(Vector2 vector)

Parameters
vector Vector2

Returns
Direction

FromVectorWith4Directions(Vector2)

public Direction FromVectorWith4Directions(Vector2 vector)

Parameters
vector Vector2

Returns
Direction

Invert(Direction)

public Direction Invert(Direction direction)

Parameters
direction Direction

Returns
Direction

LookAtEntity(Entity, Entity)

public Direction LookAtEntity(Entity e, Entity target)

Parameters
e Entity
target Entity

Returns
Direction

LookAtPosition(Entity, Vector2)

public Direction LookAtPosition(Entity e, Vector2 target)

Parameters
e Entity
target Vector2

Returns
Direction

Random()

public Direction Random()

Returns
Direction

RandomCardinal()

public Direction RandomCardinal()

Returns
Direction

Reverse(Direction)

public Direction Reverse(Direction direction)

Parameters
direction Direction

Returns
Direction

RoundTo4Directions(Direction, Orientation)

public Direction RoundTo4Directions(Direction direction, Orientation bias)

Parameters
direction Direction
bias Orientation

Returns
Direction

ToAngle(Direction)

public float ToAngle(Direction direction)

The angle of the direction, in radians.

Parameters
direction Direction

Returns
float

GetFlipped(Direction)

public ImageFlip GetFlipped(Direction direction)

Parameters
direction Direction

Returns
ImageFlip

GetFlippedHorizontal(Direction)

public ImageFlip GetFlippedHorizontal(Direction direction)

Parameters
direction Direction

Returns
ImageFlip

ToCardinal(Direction, string, string, string, string)

public string ToCardinal(Direction direction, string n, string e, string s, string w)

Parameters
direction Direction
n string
e string
s string
w string

Returns
string

ToCardinal(Direction)

public string ToCardinal(Direction direction)

Parameters
direction Direction

Returns
string

ToCardinal4(Direction, string, string, string, bool)

public string ToCardinal4(Direction direction, string n, string e, string s, bool verticalPriority)

Parameters
direction Direction
n string
e string
s string
verticalPriority bool

Returns
string

GetName(int, int, bool)

public ValueTuple<T1, T2> GetName(int i, int totalDirections, bool flipWest)

Parameters
i int
totalDirections int
flipWest bool

Returns
ValueTuple<T1, T2>

GetSuffixFromAngle(Entity, AgentSpriteComponent, float)

public ValueTuple<T1, T2> GetSuffixFromAngle(Entity entity, AgentSpriteComponent _, float angle)

Get the suffix from a suffix list based on an angle

Parameters
entity Entity
_ AgentSpriteComponent
angle float

Returns
ValueTuple<T1, T2>

ToCardinalFlipped(Direction, string, string, string)

public ValueTuple<T1, T2> ToCardinalFlipped(Direction direction, string n, string e, string s)

Parameters
direction Direction
n string
e string
s string

Returns
ValueTuple<T1, T2>

ToCardinalFlipped(Direction)

public ValueTuple<T1, T2> ToCardinalFlipped(Direction direction)

Parameters
direction Direction

Returns
ValueTuple<T1, T2>

ToVector(Direction)

public Vector2 ToVector(Direction direction)

Parameters
direction Direction

Returns
Vector2