Component
Direct Subclass:
Indirect Subclass:
Component - entity way to express it's behaviour.
Static Member Summary
| Static Public Members | ||
| public static get |
propsTypes: * |
|
Constructor Summary
| Public Constructor | ||
| public |
Constructor. |
|
Method Summary
| Public Methods | ||
| public |
deserialize(json: *) Deserialize JSON properties into this component. |
|
| public |
dispose() Destructor (dispose internal resources and detach from entity). |
|
| public |
Called when action arrived. |
|
| public |
onAlterActionArguments(name: string, args: *): array | undefined Called when asked to alter arrived action parameters. |
|
| public |
onAttach() Called after attached to entity. |
|
| public |
onDetach() Called before detached from entity. |
|
| public |
onPropertySerialize(name: string, value: *): * Called when property is serialized. |
|
| public |
onPropertySetup(name: string, value: *) Called when given property is deserialized. |
|
| public |
serialize(): * Serialize component into JSON data. |
|
Static Public Members
public static get propsTypes: * source
Static Public Methods
Public Constructors
Public Methods
public deserialize(json: *) source
Deserialize JSON properties into this component.
Params:
| Name | Type | Attribute | Description |
| json | * | Serialized JSON data. |
Example:
component.deserialize({ hello: 'world' });
component.hello === 'world';
public dispose() source
Destructor (dispose internal resources and detach from entity).
Example:
component.parent = system.root;
component.dispose();
component.parent === null;
public onAction(name: string, args: *) source
Called when action arrived.
Params:
| Name | Type | Attribute | Description |
| name | string | Action name. |
|
| args | * | Action parameters. |
public onAlterActionArguments(name: string, args: *): array | undefined source
Called when asked to alter arrived action parameters.
Params:
| Name | Type | Attribute | Description |
| name | string | Action name. |
|
| args | * | Action parameters. |
public onPropertySerialize(name: string, value: *): * source
Called when property is serialized.
Params:
| Name | Type | Attribute | Description |
| name | string | Property name. |
|
| value | * | Property value. |
Return:
| * | Serializable proeprty JSON value. |
public onPropertySetup(name: string, value: *) source
Called when given property is deserialized.
Params:
| Name | Type | Attribute | Description |
| name | string | Property name. |
|
| value | * | Property value. |
public serialize(): * source
Serialize component into JSON data.
Return:
| * | Serialized JSON data. |
Example:
component.hello = 'world';
const json = component.serialize();
json.hello === 'world';
