Packagecom.pblabs.engine.entity
Interfacepublic interface IEntityComponent
Implementors EntityComponent

A component in PBE is used to define specific pieces of functionality for game entities. Several components can be added to a single entity to give the entity complex behavior while keeping the different functionalities separate from each other.

A full featured implementation of this interface is included (EntityComponent). It should be adequate for almost every situation, and therefore, custom components should derive from it rather than implementing this interface directly.

There are several reasons why PBE is set up this way:

See also

IEntity
EntityComponent
Components chapter in manual.


Public Properties
 PropertyDefined By
  isRegistered : Boolean
[read-only] Whether or not the component is currently registered with an entity.
IEntityComponent
  name : String
[read-only] The name given to the component when it is added to an entity.
IEntityComponent
  owner : IEntity
A reference to the entity that this component currently belongs to.
IEntityComponent
Public Methods
 MethodDefined By
  
register(owner:IEntity, name:String):void
Registers the component with an entity.
IEntityComponent
  
reset():void
This is called by an entity on all of its components any time a component is added or removed.
IEntityComponent
  
unregister():void
Unregisters the component from an entity.
IEntityComponent
Property Detail
isRegisteredproperty
isRegistered:Boolean  [read-only]

Whether or not the component is currently registered with an entity.


Implementation
    public function get isRegistered():Boolean
nameproperty 
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

See also

ownerproperty 
owner:IEntity

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 equivalent to the first parameter passed to the register method.


Implementation
    public function get owner():IEntity
    public function set owner(value:IEntity):void

See also

Method Detail
register()method
public function register(owner:IEntity, name:String):void

Registers 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():void

This 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():void

Unregisters the component from an entity. This should only ever be called by an entity class from the removeComponent method.