DoopelPonger
Classes | Public Types | Public Member Functions | List of all members
EventManager Class Reference

Orchestrates the publishing, receiving, registering and deregistering events and even listeners. More...

Inheritance diagram for EventManager:
Inheritance graph
[legend]
Collaboration diagram for EventManager:
Collaboration graph
[legend]

Public Types

enum  EventType {
  EventType.PLAYER_WON, EventType.PLAYER_MISSED, EventType.CAMERA_SHAKE, EventType.OUT,
  EventType.DISPLAY_3, EventType.DISPLAY_2, EventType.DISPLAY_1, EventType.START_ROUND,
  EventType.CHANGE_TIME, EventType.COOP_PLAYER_HIT, EventType.COOP_HEALTH_INITIATED, EventType.COOP_PLAYER_CHARGE,
  EventType.COOP_PLAYER_DEAD, EventType.COOP_POWER_UP_FINISHED, EventType.COOP_HEAL_PLAYER, EventType.COOP_SCHMITTY_DOOP_SHOOT,
  EventType.COOP_PLAYER_ATTACK, EventType.COOP_SCHMITTY_DOOP_HIT, EventType.COOP_SCHMITTY_DOOP_DEATH, EventType.COOP_PLAYER_SPAWNED,
  EventType.COOP_PLAYER_LASER_ATTACK, EventType.COOP_PLAYER_CHARGE_FULL, EventType.MENU_GAME_WON, EventType.MENU_GAME_LOST,
  EventType.MENU_RESET_GAME, EventType.MENU_START_GAME, EventType.MENU_TUTORIAL, EventType.MENU_CONTROLS,
  EventType.MENU_MAIN_MENU, EventType.MENU_PAUSE_TRIGGERED, EventType.MENU_UNPAUSE_TRIGGERED, EventType.MENU_RESUME,
  EventType.MENU_EXIT, EventType.MENU_TEXT_TRANSITION, EventType.MENU_SCROLL, EventType.MENU_SELECT,
  EventType.COOP_PLAYER_GOOD_HIT, EventType.COOP_POWER_UP_TRIGGERED, EventType.COOP_MUSIC_CHANGE, EventType.COOP_PLAYER_SHIELD_DEFLECT,
  EventType.SUBMENU_SINGLE_PLAYER, EventType.SUBMENU_COOP, EventType.SUBMENU_BACK, EventType.AI_WALL_HIT,
  EventType.AI_PLAYER_HIT, EventType.CAMERA_FADE_OUT, EventType.MENU_BACKGROUND, EventType.SUBMENU_SETTINGS,
  EventType.MENU_AUDIO, EventType.AUDIO_FADE_IN, EventType.MENU_ABOUT, EventType.MENU_PAUSE,
  EventType.MENU_TEXT_TRANSITION_OUT, EventType.BALL_HIT_COLLECTOR, EventType.TUTORIAL_RESUME, EventType.NUMBER_OF_EVENTS
}
 The types of notifications that can be sent to other components to communicate when special things happen. More...
 

Public Member Functions

delegate void EventListener (EventType type, EventParameters parameter)
 The type of function that can be notified when an EventType is fired. More...
 
void Awake ()
 Initialize the data structures needed to keep track of listeners and publishers of events. More...
 
void FixedUpdate ()
 Iterate through the queue of registration actions that need to modify the list of listeners. More...
 
void DeregisterListener (EventType eventType, EventListener eventListener)
 Puts an item in the modification queue to revmove the event listener from the event type list on the next fixed update. More...
 
void DeregisterListenerImmediate (EventType eventType, EventListener eventListener)
 Remove the eventListener from the list immediately. More...
 
void RegisterListener (EventType eventType, EventListener eventListener)
 Puts an item in the modification queue to add the event listener from the event type list on the next fixed update. More...
 
void RegisterListenerImmediate (EventType eventType, EventListener eventListener)
 Add the eventListener from the list immediately. More...
 
void PublishEvent (EventType eventType, EventParameters parameters)
 Send the EventParameters to all listeners of the EventType. More...
 

Detailed Description

Orchestrates the publishing, receiving, registering and deregistering events and even listeners.

Member Enumeration Documentation

◆ EventType

The types of notifications that can be sent to other components to communicate when special things happen.

Enumerator
PLAYER_WON 
PLAYER_MISSED 
CAMERA_SHAKE 
OUT 
DISPLAY_3 
DISPLAY_2 
DISPLAY_1 
START_ROUND 
CHANGE_TIME 
COOP_PLAYER_HIT 
COOP_HEALTH_INITIATED 
COOP_PLAYER_CHARGE 
COOP_PLAYER_DEAD 
COOP_POWER_UP_FINISHED 
COOP_HEAL_PLAYER 
COOP_SCHMITTY_DOOP_SHOOT 
COOP_PLAYER_ATTACK 
COOP_SCHMITTY_DOOP_HIT 
COOP_SCHMITTY_DOOP_DEATH 
COOP_PLAYER_SPAWNED 
COOP_PLAYER_LASER_ATTACK 
COOP_PLAYER_CHARGE_FULL 
MENU_GAME_WON 
MENU_GAME_LOST 
MENU_RESET_GAME 
MENU_START_GAME 
MENU_TUTORIAL 
MENU_CONTROLS 
MENU_MAIN_MENU 
MENU_PAUSE_TRIGGERED 
MENU_UNPAUSE_TRIGGERED 
MENU_RESUME 
MENU_EXIT 
MENU_TEXT_TRANSITION 
MENU_SCROLL 
MENU_SELECT 
COOP_PLAYER_GOOD_HIT 
COOP_POWER_UP_TRIGGERED 
COOP_MUSIC_CHANGE 
COOP_PLAYER_SHIELD_DEFLECT 
SUBMENU_SINGLE_PLAYER 
SUBMENU_COOP 
SUBMENU_BACK 
AI_WALL_HIT 
AI_PLAYER_HIT 
CAMERA_FADE_OUT 
MENU_BACKGROUND 
SUBMENU_SETTINGS 
MENU_AUDIO 
AUDIO_FADE_IN 
MENU_ABOUT 
MENU_PAUSE 
MENU_TEXT_TRANSITION_OUT 
BALL_HIT_COLLECTOR 
TUTORIAL_RESUME 
NUMBER_OF_EVENTS 

Member Function Documentation

◆ Awake()

void EventManager.Awake ( )

Initialize the data structures needed to keep track of listeners and publishers of events.

◆ DeregisterListener()

void EventManager.DeregisterListener ( EventType  eventType,
EventListener  eventListener 
)

Puts an item in the modification queue to revmove the event listener from the event type list on the next fixed update.

Parameters
eventTypeThe EventType that should have the eventListener removed.
eventListenerThe callback function that should be removed.

◆ DeregisterListenerImmediate()

void EventManager.DeregisterListenerImmediate ( EventType  eventType,
EventListener  eventListener 
)

Remove the eventListener from the list immediately.

Parameters
eventTypeThe EventType that should have the eventListener removed.
eventListenerThe callback function that should be removed.

◆ EventListener()

delegate void EventManager.EventListener ( EventType  type,
EventParameters  parameter 
)

The type of function that can be notified when an EventType is fired.

◆ FixedUpdate()

void EventManager.FixedUpdate ( )

Iterate through the queue of registration actions that need to modify the list of listeners.

◆ PublishEvent()

void EventManager.PublishEvent ( EventType  eventType,
EventParameters  parameters 
)

Send the EventParameters to all listeners of the EventType.

Parameters
eventTypeThe EventType that should be notified.
parametersThe custom data to be forwarded along to all listeners of the eventType.

◆ RegisterListener()

void EventManager.RegisterListener ( EventType  eventType,
EventListener  eventListener 
)

Puts an item in the modification queue to add the event listener from the event type list on the next fixed update.

Parameters
eventTypeThe EventType that should have the eventListener added.
eventListenerThe callback function that should be added.

◆ RegisterListenerImmediate()

void EventManager.RegisterListenerImmediate ( EventType  eventType,
EventListener  eventListener 
)

Add the eventListener from the list immediately.

Parameters
eventTypeThe EventType that should have the eventListener added.
eventListenerThe callback function that should be added.

The documentation for this class was generated from the following file: