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

Represents an object in the world, containing components that describe its behaviour. More...

Inheritance diagram for Chunks.Entities.Entity:
Chunks.Entities.Object

Public Member Functions

void Destroy ()
 Removes this entity and all children from the world. More...
 
void Save (BinaryWriter writer)
 Serializes this entity to a BinaryWriter. More...
 
void Load (BinaryReader reader)
 Deserializes this entity from a BinaryReader. 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

bool Active => _gameObject.activeInHierarchy
 
override Transform Transform => _transform
 Describes this entity's location, rotation and scale. More...
 
override bool IsValid => Behaviour != null
 Tests to see if this entity hasn't been removed. More...
 

Properties

override string Name [get, set]
 The name of this entity. More...
 
bool Enabled [get, set]
 If true, this entity and its children are updated. More...
 
bool ShouldSave [get, set]
 If true, this entity will attempt to write to disk when saving. More...
 
override IWorld World [get]
 The world containing this entity. 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...
 

Detailed Description

Represents an object in the world, containing components that describe its behaviour.

Member Function Documentation

void Chunks.Entities.Entity.Destroy ( )

Removes this entity and all children from the world.

void Chunks.Entities.Entity.Load ( BinaryReader  reader)

Deserializes this entity from a BinaryReader.

Parameters
readerBinaryReader to read from
void Chunks.Entities.Entity.Save ( BinaryWriter  writer)

Serializes this entity to a BinaryWriter.

Parameters
writerBinaryWriter to write to

Member Data Documentation

bool Chunks.Entities.Entity.Active => _gameObject.activeInHierarchy
override bool Chunks.Entities.Entity.IsValid => Behaviour != null

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

override Transform Chunks.Entities.Entity.Transform => _transform

Describes this entity's location, rotation and scale.

Property Documentation

bool Chunks.Entities.Entity.Enabled
getset

If true, this entity and its children are updated.

override string Chunks.Entities.Entity.Name
getset

The name of this entity.

bool Chunks.Entities.Entity.ShouldSave
getset

If true, this entity will attempt to write to disk when saving.

override IWorld Chunks.Entities.Entity.World
get

The world containing this entity.


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