Struct Direction
Represents a direction or neutral position
public struct Direction : IEquatable<Direction>- Implements
Constructors
Direction(Vector2)
Creates a new direction from the given vector
public Direction(Vector2 direction)Parameters
Fields
Down
public static readonly Direction DownField Value
Left
public static readonly Direction LeftField Value
LeftDown
public static readonly Direction LeftDownField Value
LeftUp
public static readonly Direction LeftUpField Value
None
public static readonly Direction NoneField Value
Right
public static readonly Direction RightField Value
RightDown
public static readonly Direction RightDownField Value
RightUp
public static readonly Direction RightUpField Value
Up
public static readonly Direction UpField Value
Properties
IsNeutral
true if the direction is in a neutral position. Same as checking against Direction.None
public bool IsNeutral { get; }Property Value
Methods
Equals(Direction)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Direction other)Parameters
- otherDirection
- An object to compare with this object. 
Returns
Equals(object)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object obj)Parameters
- objobject
- The object to compare with the current instance. 
Returns
- bool
- true if - objand this instance are the same type and represent the same value; otherwise, false.
FromTicks(int, int)
Creates a new direction from a ratio. with 0/1 corresponding to the direction (0,1), 1/4 corresponding to (1,0), etc.
public static Direction FromTicks(int value, int maxValue)Parameters
- valueint
- The amount of ticks clockwise from the Up direction (numerator) 
- maxValueint
- The number of ticks representing a full rotation (denominator) 
Returns
- Direction
- A direction with ratio - valueover- maxValue
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()Returns
- int
- A 32-bit signed integer that is the hash code for this instance. 
GetTicks(int)
Retrieves the amount of ticks clockwise from the Up direction
public int GetTicks(int maxValue)Parameters
- maxValueint
- The number of ticks representing a full rotation 
Returns
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()Returns
- string
- The fully qualified type name. 
Operators
operator ==(Direction, Direction)
public static bool operator ==(Direction left, Direction right)Parameters
Returns
explicit operator Direction(Vector2)
public static explicit operator Direction(Vector2 value)Parameters
- valueVector2
Returns
explicit operator Vector2(Direction)
public static explicit operator Vector2(Direction value)Parameters
- valueDirection
Returns
operator !=(Direction, Direction)
public static bool operator !=(Direction left, Direction right)