Struct Int2
2D vector with intager data
Implements
Constructors
Int2(int, int)
Declaration
public Int2(int x, int y)
Fields
Down
Declaration
public static readonly Int2 Down
Left
Declaration
public static readonly Int2 Left
One
Declaration
public static readonly Int2 One
Right
Declaration
public static readonly Int2 Right
Up
Declaration
public static readonly Int2 Up
Zero
Declaration
public static readonly Int2 Zero
x
Declaration
public int x
y
Declaration
public int y
Properties
Area
x * y
Declaration
public readonly int Area { get; }
this[int]
Get int data inside with given index. (0 means x, 1 means y)
Declaration
public int this[int index] { readonly get; set; }
Magnitude
Length of the vector
Declaration
public readonly float Magnitude { get; }
SqrMagnitude
Square length of the vector
Declaration
public readonly int SqrMagnitude { get; }
Methods
Deconstruct(out int, out int)
Declaration
public readonly void Deconstruct(out int x, out int y)
Distance(Int2, Int2)
Distance between two given position
Declaration
public static float Distance(Int2 a, Int2 b)
Equals(Int2)
Indicates whether the current object is equal to another object of the same type.
Declaration
public readonly bool Equals(Int2 other)
Parameters
Type | Name | Description |
---|---|---|
Int2 | other | An object to compare with this object. |
Returns
Type | Description |
---|---|
bool | true if the current object is equal to the |
Equals(object)
Indicates whether this instance and a specified object are equal.
Declaration
public override readonly bool Equals(object other)
Returns
Type | Description |
---|---|
bool | true if |
Overrides
GetHashCode()
Returns the hash code for this instance.
Declaration
public override readonly int GetHashCode()
Returns
Type | Description |
---|---|
int | A 32-bit signed integer that is the hash code for this instance. |
Overrides
Set(int, int)
Declaration
public void Set(int x, int y)
Shift(int, int)
Move the position with given amount
Declaration
public readonly Int2 Shift(int x, int y)
ToString()
Returns the fully qualified type name of this instance.
Declaration
public override readonly string ToString()
Returns
Type | Description |
---|---|
string | The fully qualified type name. |
Overrides
Operators
operator +(Int2, Int2)
Declaration
public static Int2 operator +(Int2 a, Int2 b)
operator /(Int2, int)
Declaration
public static Int2 operator /(Int2 a, int b)
operator ==(Int2, Int2)
Declaration
public static bool operator ==(Int2 lhs, Int2 rhs)
explicit operator Int3(Int2)
Declaration
public static explicit operator Int3(Int2 v)
implicit operator Float2(Int2)
Declaration
public static implicit operator Float2(Int2 v)
operator !=(Int2, Int2)
Declaration
public static bool operator !=(Int2 lhs, Int2 rhs)
operator *(Int2, Int2)
Declaration
public static Int2 operator *(Int2 a, Int2 b)
operator *(Int2, int)
Declaration
public static Int2 operator *(Int2 a, int b)
operator *(int, Int2)
Declaration
public static Int2 operator *(int a, Int2 b)
operator -(Int2, Int2)
Declaration
public static Int2 operator -(Int2 a, Int2 b)
operator -(Int2)
Declaration
public static Int2 operator -(Int2 v)