Chunks
Moddable voxel sandbox for room-scale VR.
Public Member Functions | Public Attributes | Protected Member Functions | Properties | List of all members
Chunks.Entities.Component Class Reference

Base class for all components describing entity functionality. More...

Inheritance diagram for Chunks.Entities.Component:
Chunks.Entities.Object Chunks.Entities.IComponent Chunks.Entities.IObject Chunks.Agents.GroundAgent Chunks.Audio.AmbientEmitter Chunks.Entities.Holdable Chunks.Entities.Holder Chunks.Entities.ToolTip Chunks.Geometry.AABBPhysics Chunks.Interface.CameraRig Chunks.Interface.MenuDock Chunks.Interface.Pointer Chunks.Interface.ToolIcon Chunks.Interface.TrackPadDial Chunks.Interface.Wand

Public Member Functions

void DestroyComponent ()
 Removes this component from the entity that contains it. More...
 
void DestroyEntity ()
 Removes the entity containing this component from the world, along with any child entities. More...
 
override string ToString ()
 Returns a string representing this component with the format "TypeName (EntityName)." More...
 
- Public Member Functions inherited from Chunks.Entities.Object
Entity CreateChild ()
 Creates a new Entity parented to this one. More...
 
TComponent CreateChildWithComponent< TComponent > ()
 Creates a new Entity parented to this one with a component of the given type, which is returned. More...
 
Entity FindChild (string name, bool recurse=true)
 Attempts to find a child Entity of this one with the given name, and optionally searches recursively through all children. Null is returned if no matches are found. More...
 
TComponent FindChildComponent< TComponent > (string name, bool recurse=true)
 Attempts to find a child Entity of this one with the given name, and optionally searches recursively through all children. If a matching Entity is found, a component of the given type is retrieved from it. Null is returned if no matches are found. More...
 
Entity FindParent (string name)
 Attempts to find an Entity that contains this Object's Entity with the given Name. Returns null if no match is found. More...
 
TComponent FindParentComponent< TComponent > ()
 Attempts to find an Entity that contains this Object's Entity with a component of the given type. If a matching Entity is found, the component of the given type is retrieved from it. Returns null if no match is found. More...
 
TComponent FindParentComponent< TComponent > (string name)
 Attempts to find an Entity that contains this Object's Entity with the given Name. If a matching Entity is found, a component of the given type is retrieved from it. Returns null if no match is found. More...
 
TComponent AddComponent< TComponent > ()
 Adds a component of the specified type to this entity, returning the new component. More...
 
TComponent GetOrAddComponent< TComponent > ()
 Attempts to get a component of the specified type from this entity, adding it if one doesn't already exist. More...
 
TComponent GetComponent< TComponent > ()
 Attempts to get a component of the specified type from this entity, returning null if one doesn't exist. More...
 
IEnumerable< TComponent > GetComponents< TComponent > ()
 Gets all components derived from the given type. More...
 

Public Attributes

override bool IsValid => Behaviour != null
 Tests to see if this component hasn't been removed. More...
 

Protected Member Functions

object Wait (float timeSeconds)
 Suspends coroutine operation for the given time when yielded. More...
 
object StartCoroutine (IEnumerator routine)
 Starts execution of a coroutine. More...
 
virtual void OnSave (BinaryWriter writer)
 Implement this and OnLoad to enable serialization of this component when the parent entity saves. More...
 
virtual void OnLoad (BinaryReader reader)
 Implement this and OnSave to enable serialization of this component when the parent entity saves. More...
 
virtual void OnInitialize ()
 Called only once, when the component is first attached to an entity and is ready to add or retrieve other components. More...
 
virtual void OnEnable ()
 Called each time this component goes from being disabled to enabled. More...
 
virtual void OnDisable ()
 Called each time this component goes from being enabled to disabled. More...
 
virtual void OnUpdate ()
 Called once per world update if this component and its parent entity are enabled. More...
 
virtual void OnPhysicsUpdate ()
 Called at a fixed time step for any time dependant physics calculations. More...
 
virtual void OnDestroy ()
 Called when this component is removed, or the parent entity is destroyed. More...
 
virtual void OnPreRender ()
 Called just before the entity containing this component is rendered. More...
 

Properties

Entity Entity [get]
 The entity this instance is attached to. More...
 
bool IsSavingImplemented [get]
 If true, OnSave and OnLoad have been implemented for this type. More...
 
bool Enabled [get, set]
 Enabled components will be updated, assuming they are within enabled entities. More...
 
- Properties inherited from Chunks.Entities.Object
abstract bool IsValid [get]
 Tests to see if this object hasn't been removed. More...
 
virtual string Name [get, set]
 Custom name associated with this Object's Entity, used to find the Entity in the hierarchy. More...
 
virtual Transform Transform [get]
 Transformation of this Object's Entity. More...
 
virtual IWorld World [get]
 The IWorld that contains this Object. More...
 
- Properties inherited from Chunks.Entities.IComponent
Entity Entity [get]
 
bool IsSavingImplemented [get]
 
bool Enabled [get, set]
 
- Properties inherited from Chunks.Entities.IObject
bool IsValid [get]
 
string Name [get, set]
 
Transform Transform [get]
 
IWorld World [get]
 

Detailed Description

Base class for all components describing entity functionality.

Member Function Documentation

void Chunks.Entities.Component.DestroyComponent ( )

Removes this component from the entity that contains it.

void Chunks.Entities.Component.DestroyEntity ( )

Removes the entity containing this component from the world, along with any child entities.

virtual void Chunks.Entities.Component.OnDestroy ( )
protectedvirtual

Called when this component is removed, or the parent entity is destroyed.

Reimplemented in Chunks.Interface.Wand, Chunks.Geometry.AABBPhysics, Chunks.Entities.ToolTip, Chunks.Interface.TrackPadDial, Chunks.Entities.Holder, and Chunks.Interface.Pointer.

virtual void Chunks.Entities.Component.OnDisable ( )
protectedvirtual

Called each time this component goes from being enabled to disabled.

Reimplemented in Chunks.Interface.Wand, Chunks.Geometry.AABBPhysics, Chunks.Entities.ToolTip, Chunks.Interface.TrackPadDial, Chunks.Interface.Pointer, and Chunks.Interface.ToolIcon.

virtual void Chunks.Entities.Component.OnEnable ( )
protectedvirtual

Called each time this component goes from being disabled to enabled.

Reimplemented in Chunks.Geometry.AABBPhysics, Chunks.Entities.ToolTip, Chunks.Interface.TrackPadDial, Chunks.Interface.Pointer, and Chunks.Interface.ToolIcon.

virtual void Chunks.Entities.Component.OnInitialize ( )
protectedvirtual
virtual void Chunks.Entities.Component.OnLoad ( BinaryReader  reader)
protectedvirtual

Implement this and OnSave to enable serialization of this component when the parent entity saves.

Parameters
readerReader to deserialize from
virtual void Chunks.Entities.Component.OnPhysicsUpdate ( )
protectedvirtual

Called at a fixed time step for any time dependant physics calculations.

Reimplemented in Chunks.Interface.Wand, Chunks.Geometry.AABBPhysics, Chunks.Agents.GroundAgent, and Chunks.Entities.Holdable.

virtual void Chunks.Entities.Component.OnPreRender ( )
protectedvirtual

Called just before the entity containing this component is rendered.

Reimplemented in Chunks.Interface.Pointer.

virtual void Chunks.Entities.Component.OnSave ( BinaryWriter  writer)
protectedvirtual

Implement this and OnLoad to enable serialization of this component when the parent entity saves.

Parameters
writerWriter to serialize to
virtual void Chunks.Entities.Component.OnUpdate ( )
protectedvirtual

Called once per world update if this component and its parent entity are enabled.

Reimplemented in Chunks.Interface.TrackPadDial, Chunks.Entities.ToolTip, Chunks.Agents.GroundAgent, Chunks.Interface.MenuDock, Chunks.Interface.CameraRig, and Chunks.Audio.AmbientEmitter.

object Chunks.Entities.Component.StartCoroutine ( IEnumerator  routine)
protected

Starts execution of a coroutine.

Parameters
routineEnumerator returned by a coroutine method
override string Chunks.Entities.Component.ToString ( )

Returns a string representing this component with the format "TypeName (EntityName)."

object Chunks.Entities.Component.Wait ( float  timeSeconds)
protected

Suspends coroutine operation for the given time when yielded.

Parameters
timeSecondsTime to suspend operation for in seconds

Member Data Documentation

override bool Chunks.Entities.Component.IsValid => Behaviour != null

Tests to see if this component hasn't been removed.

Property Documentation

bool Chunks.Entities.Component.Enabled
getset

Enabled components will be updated, assuming they are within enabled entities.

Entity Chunks.Entities.Component.Entity
get

The entity this instance is attached to.

bool Chunks.Entities.Component.IsSavingImplemented
get

If true, OnSave and OnLoad have been implemented for this type.


The documentation for this class was generated from the following file: