Table of Contents

Struct EntityLink<T>

Namespace
Typhon.Engine
Assembly
Typhon.Engine.dll

Typed entity reference — an 8-byte wrapper around EntityId that provides compile-time archetype safety. An EntityLink<T> accepts Building, House, or any descendant archetype.

public readonly struct EntityLink<T> : IEquatable<EntityLink<T>> where T : class

Type Parameters

T

The target archetype type (or ancestor for polymorphic references).

Implements
Inherited Members

Fields

The null link sentinel.

public static readonly EntityLink<T> Null

Field Value

EntityLink<T>

Properties

The underlying EntityId.

public EntityId Id { get; }

Property Value

EntityId

True if this link points to no entity.

public bool IsNull { get; }

Property Value

bool

Methods

Returns true when obj is an EntityLink<T> equal to this one.

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

Returns true when other wraps the same EntityId.

public bool Equals(EntityLink<T> other)

Parameters

other EntityLink<T>

Returns

bool

Hash of the underlying EntityId.

public override int GetHashCode()

Returns

int

Human-readable form, e.g. EntityLink<Building>(...), or the null form for an empty link.

public override string ToString()

Returns

string

Operators

Value equality of two typed links (compares the underlying EntityId).

public static bool operator ==(EntityLink<T> left, EntityLink<T> right)

Parameters

left EntityLink<T>
right EntityLink<T>

Returns

bool

Wraps a raw EntityId as a typed link; no archetype compatibility check is performed.

public static implicit operator EntityLink<T>(EntityId id)

Parameters

id EntityId

Returns

EntityLink<T>

Unwraps the link to its underlying EntityId.

public static implicit operator EntityId(EntityLink<T> link)

Parameters

link EntityLink<T>

Returns

EntityId

Value inequality of two typed links (compares the underlying EntityId).

public static bool operator !=(EntityLink<T> left, EntityLink<T> right)

Parameters

left EntityLink<T>
right EntityLink<T>

Returns

bool