| Package | PBLabs.Engine.Entity |
| Class | public class EntityComponent |
| Implements | IEntityComponent |
| Subclasses | AnimatedComponent, BaseRenderComponent, BaseSceneComponent, BasicSpatialManager2D, Box2DManagerComponent, Box2DSpatialComponent, DataComponent, GroupManagerComponent, GroupMemberComponent, MultiSpriteSheetHelper, SpriteSheetComponent, TickedComponent |
See also
| Property | Defined by | ||
|---|---|---|---|
| IsRegistered : Boolean [read-only]
Whether or not the component is currently registered with an entity.
| EntityComponent | ||
| Name : String [read-only]
The name given to the component when it is added to an entity.
| EntityComponent | ||
| Owner : IEntity
[read-only]
A reference to the entity that this component currently belongs to.
| EntityComponent | ||
| Method | Defined by | ||
|---|---|---|---|
|
Registers the component with an entity.
| EntityComponent | ||
|
Reset():void
This is called by an entity on all of its components any time a component
is added or removed.
| EntityComponent | ||
|
Unregister():void
Unregisters the component from an entity.
| EntityComponent | ||
| Method | Defined by | ||
|---|---|---|---|
|
_OnAdd():void
This is called when the component is added to an entity.
| EntityComponent | ||
|
_OnRemove():void
This is called when the component is removed from an entity.
| EntityComponent | ||
|
_OnReset():void
This is called anytime a component is added or removed from the owner entity.
| EntityComponent | ||
| IsRegistered | property |
IsRegistered:Boolean [read-only]Whether or not the component is currently registered with an entity.
Implementation public function get IsRegistered():Boolean
| Name | property |
Name:String [read-only]The name given to the component when it is added to an entity. This value should be equivelent to the second parameter passed to the Register method.
Implementation public function get Name():String
| Owner | property |
Owner:IEntity [read-only]A reference to the entity that this component currently belongs to. If the component has not been added to an entity, this will be null. This value should be equivelent to the first parameter passed to the Register method.
Implementation public function get Owner():IEntity
| _OnAdd | () | method |
protected function _OnAdd():voidThis is called when the component is added to an entity. Any initialization, event registration, or object lookups should happen here. Component lookups on the owner entity should NOT happen here. Use _OnReset instead.
See also
| _OnRemove | () | method |
protected function _OnRemove():voidThis is called when the component is removed from an entity. It should reverse anything that happened in _OnAdd or _OnReset (like removing event listeners or nulling object references).
| _OnReset | () | method |
protected function _OnReset():voidThis is called anytime a component is added or removed from the owner entity. Lookups of other components on the owner entity should happen here.
This can potentially be called multiple times, so make sure previous lookups are properly cleaned up each time.
| Register | () | method |
public function Register(owner:IEntity, name:String):voidRegisters the component with an entity. This should only ever be called by an entity class from the AddComponent method.
Parametersowner:IEntity — The entity to register the component with.
|
|
name:String — The name to assign to the component.
|
| Reset | () | method |
public function Reset():voidThis is called by an entity on all of its components any time a component is added or removed. In this method, any references to properties on the owner entity should be purged and re-looked up.
| Unregister | () | method |
public function Unregister():voidUnregisters the component from an entity. This should only ever be called by an entity class from the RemoveComponent method.