new State()
Methods
-
enter(owner)
-
This method is called once during a state transition when the StateMachine makes this state active.
Parameters:
Name Type Description owner
GameEntity The game entity that represents the execution context of this state.
-
execute(owner)
-
This method is called per simulation step if this state is active.
Parameters:
Name Type Description owner
GameEntity The game entity that represents the execution context of this state.
-
exit(owner)
-
This method is called once during a state transition when the StateMachine makes this state inactive.
Parameters:
Name Type Description owner
GameEntity The game entity that represents the execution context of this state.
-
fromJSON(json) → {State}
-
Restores this instance from the given JSON object.
Parameters:
Name Type Description json
Object The JSON object.
-
onMessage(owner, telegram) → {Boolean}
-
This method is called when messaging between game entities occurs.
Parameters:
Name Type Description owner
GameEntity The game entity that represents the execution context of this state.
telegram
Telegram A data structure containing the actual message.
Returns:
Boolean -Whether the message was processed or not.
-
resolveReferences(entities) → {State}
-
Restores UUIDs with references to GameEntity objects.
Parameters:
Name Type Description entities
Map.<String, GameEntity> Maps game entities to UUIDs.
-
toJSON() → {Object}
-
Transforms this instance into a JSON object.
Returns:
Object -The JSON object.