MessageDispatcher class

This class is the core of the messaging system for game entities and used by the { @link EntityManager}. The implementation can directly dispatch messages or use a delayed delivery for deferred communication. This can be useful if a game entity wants to inform itself about a particular event in the future.

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

Constructors

MessageDispatcher()

Properties

delayedTelegrams ↔ List<Telegram>
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

Methods

clear() → MessageDispatcher
Clears the internal state of this message dispatcher.
deliver(Telegram telegram) → MessageDispatcher
Delivers the message to the receiver.
dispatch(GameEntity sender, GameEntity receiver, String message, double delay, [Map<String, dynamic>? data]) → MessageDispatcher
Receives the raw telegram data and decides how to dispatch the telegram (with or without delay).
dispatchDelayedMessages(double delta) → MessageDispatcher
Used to process delayed messages.
fromJSON(Map<String, dynamic> json) → MessageDispatcher
Restores this instance from the given JSON object.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolveReferences(Map<String, GameEntity> entities) → MessageDispatcher
Restores UUIDs with references to GameEntity objects.
toJSON() → Map<String, dynamic>
Transforms this instance into a JSON object.
toString() → String
A string representation of this object.
inherited

Operators

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