![]() |
SpaceRTS - Starter Pack
1.3
|
Represents a Component reference that can be assigned directly through editor or must be taken from a component proxy in runtime. More...
Public Types | |
enum | RefType { RefType.Direct, RefType.UseProxy } |
Types of references for the component cache. More... | |
Public Member Functions | |
T | Get< T > () |
The casted component stored in the cache. More... | |
void | SetDirect (Component val) |
Set the cached reference and sets the the allowedType as RefType.Direct. More... | |
ProxyRef () | |
Parameterless constructor. Sets the allowedType field as typeof(Component). More... | |
ProxyRef (System.Type type, string defaultName="") | |
Constructor that sets the component allowed type and the default property name for the ComponentProxy setting. More... | |
void | Assign (ComponentProxy proxy) |
Assign a cached reference stored in the ComponentProxy according with the internal property name. More... | |
void | Assign (GameEntity entity) |
Assigns the component reference stored in the GameEntity VisualProxy according with the stored property name. More... | |
void | SafeAssign (GameEntity entity) |
Assigns the cached component only if internally was configured to use a proxy component More... | |
void | Clear () |
Forces to clear the cache reference of the component. More... | |
void | SafeClear () |
Removes the component reference only if internally was configured to use a proxy component. More... | |
Static Public Member Functions | |
static bool | IsInvalid (ProxyRef val) |
Indicates whether the specified ProxyRef is null or has an invalid cached reference. More... | |
Public Attributes | |
string | refname |
The name of the property in the ComponentProxy to use. This value is not used if the refType is Direct. More... | |
Component | cache |
The cache reference for the component to use. More... | |
RefType | refType = RefType.UseProxy |
Indicates if the component cache must be assigned directly or through a ComponentProxy property. More... | |
System.Type | allowedType |
The Component type allowed to be assigned in the editor. More... | |
Represents a Component reference that can be assigned directly through editor or must be taken from a component proxy in runtime.
|
strong |
Types of references for the component cache.
Enumerator | |
---|---|
Direct | The reference cache must be assigned directly |
UseProxy | The reference cache must be taken from a ComponentProxy property. |
GameBase.ProxyRef.ProxyRef | ( | ) |
Parameterless constructor. Sets the allowedType field as typeof(Component).
GameBase.ProxyRef.ProxyRef | ( | System.Type | type, |
string | defaultName = "" |
||
) |
Constructor that sets the component allowed type and the default property name for the ComponentProxy setting.
type | The valid type for reference assignment. |
defaultName | The default name for the ComponentProxy property. |
void GameBase.ProxyRef.Assign | ( | ComponentProxy | proxy | ) |
Assign a cached reference stored in the ComponentProxy according with the internal property name.
proxy | The ComponentProxy where to take the reference. |
void GameBase.ProxyRef.Assign | ( | GameEntity | entity | ) |
Assigns the component reference stored in the GameEntity VisualProxy according with the stored property name.
entity | The GameEntity that contains a VisualProxy where to take the reference. |
void GameBase.ProxyRef.Clear | ( | ) |
Forces to clear the cache reference of the component.
T GameBase.ProxyRef.Get< T > | ( | ) |
The casted component stored in the cache.
T | The Component type to convert in the result. |
T | : | Component |
|
static |
void GameBase.ProxyRef.SafeAssign | ( | GameEntity | entity | ) |
Assigns the cached component only if internally was configured to use a proxy component
entity | The GameEntity that contains a VisualProxy where to take the reference. |
void GameBase.ProxyRef.SafeClear | ( | ) |
Removes the component reference only if internally was configured to use a proxy component.
void GameBase.ProxyRef.SetDirect | ( | Component | val | ) |
Set the cached reference and sets the the allowedType as RefType.Direct.
val | The new component reference value to cache. |
System.Type GameBase.ProxyRef.allowedType |
The Component type allowed to be assigned in the editor.
Component GameBase.ProxyRef.cache |
The cache reference for the component to use.
string GameBase.ProxyRef.refname |
The name of the property in the ComponentProxy to use. This value is not used if the refType is Direct.
RefType GameBase.ProxyRef.refType = RefType.UseProxy |
Indicates if the component cache must be assigned directly or through a ComponentProxy property.