Class ReferenceProvider
Provides references to ReferenceRequester data containers.
Inheritance
Inherited Members
Namespace: LobsterFramework
Assembly: LobsterFramework.dll
Syntax
public abstract class ReferenceProvider : MonoBehaviour
Methods
| Improve this Doc View SourceBind(ReferenceRequester)
Bind the data container with the reference provider to update the set of fields required to store the references required by the data container. The required references of any previous binded data container different from the currently binded one will be lost. This component will listen to changes made to the data container and react accordingly. This method should always be called in the "OnValidate" message to ensure the listeners are properly hooked up
Declaration
protected void Bind(ReferenceRequester referenceRequester)
Parameters
Type | Name | Description |
---|---|---|
ReferenceRequester | referenceRequester | The data container requesting component references to be binded with |
GetComponentReference<T>(Type, int)
Get the reference requested by the type of the data stored in the binded data container.
Declaration
public T GetComponentReference<T>(Type requesterType, int index = 0) where T : Component
Parameters
Type | Name | Description |
---|---|---|
Type | requesterType | The type of the data stored in the binded data container requesting for reference |
int | index |
Returns
Type | Description |
---|---|
T | The requested reference if present, otherwise null |
Type Parameters
Name | Description |
---|---|
T | The type of the component reference being requested |
IsRequirementSatisfied(Type)
Check if the binded requester's requirements has been satisfied. Meaning all required fields must be non-null.
Declaration
public bool IsRequirementSatisfied(Type typeRequesting)
Parameters
Type | Name | Description |
---|---|---|
Type | typeRequesting | The type of the data within the binded data container requesting component references to check for |
Returns
Type | Description |
---|---|
bool | true if all required references are present, false otherwise |
OnDestroy()
Unbind with the data container requesting component references
Declaration
protected void OnDestroy()
OnValidate()
Validate and hook up listeners with the data container requesting component references
Declaration
protected void OnValidate()
UnBind()
Declaration
protected void UnBind()