Registering GamePlay objects for a game level

The GamePlay objects should be registered to the kheljs runtime during initialization from the GameLevel object or from any manager component. Typically a manager object will register all GamePlay objects related to its functionality. For example, all GamePlay objects related to player will be registered by the PlayerManager component while all GamePlay objects related to inventory are registered by the InventoryManager component. To register a GamePlay object from a Manager component, you can simply call the registerGameplay() method as shown below. The gameplayEngine object is injected to the manager by the GameLevel object during initialization.

class PlayerManager {
init() {
this.gameplayEngine.registerGamePlay( PlayerRaisesHand() );
this.gameplayEngine.registerGamePlay( PlayerCheers() );
this.gameplayEngine.registerGamePlay( PlayerSwapGuns() );
this.gameplayEngine.registerGamePlay( PlayerPicksupGun() );
this.gameplayEngine.registerGamePlay( PlayerFiresGun() );
this.gameplayEngine.registerGamePlay( PlayerReloadsGun() );