EntityManager class

This class is used for managing all central objects of a game like game entities.

@author {@link https://github.com/Mugen87|Mugen87}

Constructors

EntityManager()

Properties

candidates → List
final
entities ↔ List<GameEntity>
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
spatialIndex ↔ CellSpacePartitioning?
getter/setter pair

Methods

add(GameEntity entity) → EntityManager
Adds a game entity to this entity manager.
clear() → EntityManager
Clears the internal state of this entity manager.
fromJSON(Map<String, dynamic> json) → EntityManager
Restores this instance from the given JSON object.
getEntityByName(String name) → GameEntity?
Returns an entity by the given name. If no game entity is found, null is returned. This method should be used once (e.g. at {@link GameEntity#start}) and the result should be cached for later use.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
processTrigger(Trigger trigger) → EntityManager
Processes a single trigger.
registerType(String type, Function constructor) → EntityManager
Registers a custom type for deserialization. When calling {@link EntityManager#fromJSON} the entity manager is able to pick the correct constructor in order to create custom game entities.
remove(GameEntity entity) → EntityManager
Removes a game entity from this entity manager.
sendMessage(GameEntity sender, GameEntity receiver, String message, double delay, [Map<String, dynamic>? data]) → EntityManager
Interface for game entities so they can send messages to other game entities.
toJSON() → Map<String, dynamic>
Transforms this instance into a JSON object.
toString() → String
A string representation of this object.
inherited
update(double delta) → EntityManager
The central update method of this entity manager. Updates all game entities and delayed messages.
updateEntity(GameEntity entity, double delta) → EntityManager
Updates a single entity.
updateNeighborhood(GameEntity entity) → EntityManager
Updates the neighborhood of a single game entity.

Operators

operator ==(Object other) → bool
The equality operator.
inherited