Remote Explorer Game
Search Results for

    Show / Hide Table of Contents

    Struct Vector

    Represents a 2D coordinate or movement vector.

    Inherited Members
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: ExplorerGame.Core
    Assembly: explorer-game.dll
    Syntax
    public struct Vector

    Constructors

    | Edit this page View Source

    Vector(int, int)

    Initializes a new Vector with the specified coordinates.

    Declaration
    public Vector(int x, int y)
    Parameters
    Type Name Description
    int x

    The X-coordinate.

    int y

    The Y-coordinate.

    Fields

    | Edit this page View Source

    Zero

    A zero vector at coordinates (0, 0).

    Declaration
    public static readonly Vector Zero
    Field Value
    Type Description
    Vector

    Properties

    | Edit this page View Source

    X

    X-coordinate.

    Declaration
    public int X { readonly get; set; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    Y

    Y-coordinate.

    Declaration
    public int Y { readonly get; set; }
    Property Value
    Type Description
    int

    Methods

    | Edit this page View Source

    Equals(object?)

    Determines whether this instance and a specified object, which must also be a Vector, have the same coordinates.

    Declaration
    public override readonly bool Equals(object? obj)
    Parameters
    Type Name Description
    object obj

    The object to compare with the current instance.

    Returns
    Type Description
    bool

    true if the objects are equal; otherwise, false.

    Overrides
    ValueType.Equals(object)
    | Edit this page View Source

    GetHashCode()

    Returns a hash code for this vector.

    Declaration
    public override readonly int GetHashCode()
    Returns
    Type Description
    int

    A 32-bit signed integer hash code.

    Overrides
    ValueType.GetHashCode()
    | Edit this page View Source

    ToString()

    Returns a string representation of the vector in the form (X, Y).

    Declaration
    public override readonly string ToString()
    Returns
    Type Description
    string

    A string describing this vector.

    Overrides
    ValueType.ToString()

    Operators

    | Edit this page View Source

    operator +(Vector, Vector)

    Adds two vectors component-wise.

    Declaration
    public static Vector operator +(Vector a, Vector b)
    Parameters
    Type Name Description
    Vector a

    The first vector.

    Vector b

    The second vector.

    Returns
    Type Description
    Vector

    The vector sum (a.X + b.X, a.Y + b.Y).

    | Edit this page View Source

    operator ==(Vector, Vector)

    Determines whether two vectors are equal (same coordinates).

    Declaration
    public static bool operator ==(Vector a, Vector b)
    Parameters
    Type Name Description
    Vector a

    The first vector.

    Vector b

    The second vector.

    Returns
    Type Description
    bool

    true if a and b are equal; otherwise, false.

    | Edit this page View Source

    operator ==(Vector?, Vector?)

    Determines whether two nullable vectors are equal.

    Declaration
    public static bool operator ==(Vector? a, Vector? b)
    Parameters
    Type Name Description
    Vector? a

    The first vector, or null.

    Vector? b

    The second vector, or null.

    Returns
    Type Description
    bool

    true if both are null or have equal coordinates; otherwise, false.

    | Edit this page View Source

    operator !=(Vector, Vector)

    Determines whether two vectors are not equal.

    Declaration
    public static bool operator !=(Vector a, Vector b)
    Parameters
    Type Name Description
    Vector a

    The first vector.

    Vector b

    The second vector.

    Returns
    Type Description
    bool

    true if the vectors differ; otherwise, false.

    | Edit this page View Source

    operator !=(Vector?, Vector?)

    Determines whether two nullable vectors are not equal.

    Declaration
    public static bool operator !=(Vector? a, Vector? b)
    Parameters
    Type Name Description
    Vector? a

    The first vector, or null.

    Vector? b

    The second vector, or null.

    Returns
    Type Description
    bool

    true if they are not both null and not equal; otherwise, false.

    | Edit this page View Source

    operator -(Vector, Vector)

    Subtracts vector b from vector a component-wise.

    Declaration
    public static Vector operator -(Vector a, Vector b)
    Parameters
    Type Name Description
    Vector a

    The minuend vector.

    Vector b

    The subtrahend vector.

    Returns
    Type Description
    Vector

    The vector difference (a.X - b.X, a.Y - b.Y).

    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX