Constructor
new BaseComponent(component_type, entities)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
component_type |
string | Component type constant |
entities |
Array.<BaseEntity> | Array of BaseEntity instances |
Members
component_type :string
- Description:
- Component constant
- Source:
Component constant
Type:
- string
entities :Array.<BaseEntity>
- Description:
- Array of BaseEntity instances
- Source:
Array of BaseEntity instances
Type:
- Array.<BaseEntity>
Methods
(static) Types() → {Array.<string>}
- Description:
- Returns an array of all the available component type strings This needs to be overridden by child classes
- Source:
Returns:
- Type
- Array.<string>
GetEntityByTag(tag) → (nullable) {BaseEntity}
- Description:
- Get an BaseEntity by tag
- Source:
Example
let entity = component.GetEntityByTag(OccupantEntity.HEAD_NODE);
Parameters:
Name | Type | Description |
---|---|---|
tag |
string | Entity tag |
Returns:
- Type
- BaseEntity
toJSON() → {object}
- Description:
- JSON representation
- Source:
Example
let json = component.toJSON();
Returns:
- Type
- object