Quantum 3 3.0.5

Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Properties | List of all members
Quantum.ComponentPrototypeRef Struct Reference

Represents a generalized reference to a component prototype. The prototype can either come from an entity prototype asset or from a map asset. Type is stored as a ComponentTypeRef. More...

Inherits IEquatable< ComponentPrototypeRef >.

Public Member Functions

readonly bool Equals (ComponentPrototypeRef other)
 
readonly override bool Equals (object obj)
 
readonly override int GetHashCode ()
 
readonly override string ToString ()
 Returns a string that represents the current ComponentPrototypeRef in the format of: More...
 

Static Public Member Functions

static ComponentPrototypeRef FromEntityPrototypeRefAndType (EntityPrototypeRef prototypeRef, ComponentTypeRef type)
 Creates a new ComponentPrototypeRef from the specified EntityPrototypeRef and component type. More...
 
static ComponentPrototypeRef FromEntityPrototypeRefAndType (EntityPrototypeRef prototypeRef, Type type)
 Creates a new ComponentPrototypeRef from the specified EntityPrototypeRef and component type. More...
 
static ComponentPrototypeRef FromEntityPrototypeRefAndTypeIndex (EntityPrototypeRef prototypeRef, int typeIndex)
 Creates a new ComponentPrototypeRef from the specified EntityPrototypeRef and component type index. More...
 
static bool operator!= (ComponentPrototypeRef a, ComponentPrototypeRef b)
 
static bool operator== (ComponentPrototypeRef a, ComponentPrototypeRef b)
 
static void Serialize (void *ptr, FrameSerializer stream)
 Serializes the ComponentPrototypeRef to the specified FrameSerializer stream. More...
 

Public Attributes

AssetRef Asset
 The asset reference of the entity prototype asset or the map asset. More...
 
ComponentTypeRef ComponentType
 Type of the component. More...
 
readonly EntityPrototypeRef EntityPrototypeRef => new EntityPrototypeRef() { Asset = Asset, InnerAssetId = InnerAssetId }
 Returns a reference to the entity prototype hosting the component prototype. More...
 
int InnerAssetId
 Index of the host entity prototype, if the component prototype comes from a map asset. More...
 
readonly bool IsValid => Asset.Id.IsValid && ComponentType.IsValid
 Returns true if the component prototype reference is valid. More...
 

Static Public Attributes

const int SIZE = AssetRef.SIZE + sizeof(int) + ComponentTypeRef.SIZE
 

Properties

readonly int ComponentTypeIndex [get]
 Returns the index of the component type. More...
 

Detailed Description

Represents a generalized reference to a component prototype. The prototype can either come from an entity prototype asset or from a map asset. Type is stored as a ComponentTypeRef.

Member Function Documentation

◆ Serialize()

static void Quantum.ComponentPrototypeRef.Serialize ( void *  ptr,
FrameSerializer  stream 
)
inlinestatic

Serializes the ComponentPrototypeRef to the specified FrameSerializer stream.

Parameters
ptrA pointer to the ComponentPrototypeRef to be serialized.
streamThe FrameSerializer stream to serialize to.

◆ ToString()

readonly override string Quantum.ComponentPrototypeRef.ToString ( )
inline

Returns a string that represents the current ComponentPrototypeRef in the format of:

[ComponentPrototypeRef Asset: {Asset}, InnerAssetId: {InnerAssetId}, ComponentType: {ComponentType}]

◆ FromEntityPrototypeRefAndTypeIndex()

static ComponentPrototypeRef Quantum.ComponentPrototypeRef.FromEntityPrototypeRefAndTypeIndex ( EntityPrototypeRef  prototypeRef,
int  typeIndex 
)
inlinestatic

Creates a new ComponentPrototypeRef from the specified EntityPrototypeRef and component type index.

Parameters
prototypeRefThe EntityPrototypeRef to create the ComponentPrototypeRef from.
typeIndexThe index of the component type.
Returns
A new ComponentPrototypeRef instance.

◆ FromEntityPrototypeRefAndType() [1/2]

static ComponentPrototypeRef Quantum.ComponentPrototypeRef.FromEntityPrototypeRefAndType ( EntityPrototypeRef  prototypeRef,
ComponentTypeRef  type 
)
inlinestatic

Creates a new ComponentPrototypeRef from the specified EntityPrototypeRef and component type.

Parameters
prototypeRefThe EntityPrototypeRef to create the ComponentPrototypeRef from.
typeThe ComponentTypeRef of the component.
Returns
A new ComponentPrototypeRef instance.

◆ FromEntityPrototypeRefAndType() [2/2]

static ComponentPrototypeRef Quantum.ComponentPrototypeRef.FromEntityPrototypeRefAndType ( EntityPrototypeRef  prototypeRef,
Type  type 
)
inlinestatic

Creates a new ComponentPrototypeRef from the specified EntityPrototypeRef and component type.

Parameters
prototypeRefThe EntityPrototypeRef to create the ComponentPrototypeRef from.
typeThe Type of the component.
Returns
A new ComponentPrototypeRef instance.

Member Data Documentation

◆ Asset

AssetRef Quantum.ComponentPrototypeRef.Asset

The asset reference of the entity prototype asset or the map asset.

◆ InnerAssetId

int Quantum.ComponentPrototypeRef.InnerAssetId

Index of the host entity prototype, if the component prototype comes from a map asset.

◆ ComponentType

ComponentTypeRef Quantum.ComponentPrototypeRef.ComponentType

Type of the component.

◆ IsValid

readonly bool Quantum.ComponentPrototypeRef.IsValid => Asset.Id.IsValid && ComponentType.IsValid

Returns true if the component prototype reference is valid.

◆ EntityPrototypeRef

readonly EntityPrototypeRef Quantum.ComponentPrototypeRef.EntityPrototypeRef => new EntityPrototypeRef() { Asset = Asset, InnerAssetId = InnerAssetId }

Returns a reference to the entity prototype hosting the component prototype.

Property Documentation

◆ ComponentTypeIndex

readonly int Quantum.ComponentPrototypeRef.ComponentTypeIndex
get

Returns the index of the component type.