Create listeners for events and dispatch events in simulations.
Create listeners for events and dispatch events in simulations.
Refer to the following examples for your own scenarios:
// add listeners
Globals.api.worldStateSystem.AddListener(WorldEvent.waypointReached, OnWaypointReached);
Globals.api.worldStateSystem.AddListener(WorldEvent.waypointReached, OnWaypointReached2);
Globals.api.worldStateSystem.AddListener(WorldEvent.waypointReached, OnWaypointReached3);
// dispatch
Globals.api.worldStateSystem.DispatchEvent(WorldEvent.waypointReached, new TestEvent { x = 100 });
Globals.api.worldStateSystem.DispatchEvent(WorldEvent.waypointReached, 10);
Globals.api.worldStateSystem.DispatchEvent(WorldEvent.waypointReached, new WaypointReachedEvent(wp, blueAgent));
// remove
Globals.api.worldStateSystem.RemoveListener(WorldEvent.waypointReached, OnWaypointReached2);