Component

defines properties that can be added to entities

new ocs.Component(environment, name, builder);


Parameter Type Description
environment String / Number name of the environment to add the component to
name String / Number unique name of the component
builder Function a function that returns an object containing properties to add to entities. This function can take whatever parameters you would like

Methods

Properties


Methods

getEntites

returns an array of all the Entities containing this Component

ocs.Component.getEntites();

printEntites

returns an array of the names of all the Entities containing this Component

ocs.Component.printEntites();

duplicate

duplicate this Component to another Environment

ocs.Component.duplicate(environment);


Parameter Type Description
environment String / Number Name of the Environment to add the duplicated Component to

destroy

destroy this Component and remove it from all Entities that have this Component

ocs.Component.destroy();


Properties

name

String / Number

reference to the name of the component

ocs.Component.name

builder

Function

reference to the builder of the component

ocs.Component.builder