| Package | com.pblabs.engine.entity |
| Class | public class EntityComponent |
| Inheritance | EntityComponent Object |
| Implements | IEntityComponent |
| Subclasses | AnimatedComponent, BasicSpatialManager2D, Box2DManagerComponent, Box2DSpatialComponent, DataComponent, EventSoundTrigger, GoogleSpreadsheetTweaker, GroupManagerComponent, GroupMemberComponent, HealthComponent, MachineDescription, MultiSpriteSheetHelper, SpriteContainerComponent, ThinkingComponent, TickedComponent, TweenComponent, TweenController |
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
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.
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.
public function get name():String| owner | property |
owner:IEntityA 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 equivalent to the first parameter passed to the register method.
public function get owner():IEntity public function set owner(value:IEntity):void| 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 IEntity from the addComponent method.
Parameters
owner: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.