Event Listening
The GameFlow API also exposes a series of subclasses of GFEvent
that represent the different events that GameFlow is able to manage. These classes are the following:
Scope | Event Classes |
Application | |
Physics | |
User Interface | |
Activation | |
Customization | |
Communication | |
Game | |
Keyboard | |
Localization | |
Mouse | |
Timer | |
Program | |
Data | |
Scenes |
Event subscription
Any object that implements the IEventListener
interface can be added to the list of subscribers that will receive a notification when an event of a certain type is triggered. This allows your own scripts to react to events triggered by GameFlow programs.
The steps to follow to do this are:
Implement in our script the
IsListening()
andEventReceived()
methods of theIEventListener
interface to filter and respond to events.Invoke the
AddListener()
static method of the type of event to which we want an instance of our script to subscribe.
In the following example, each instance of our MyEventHook
script is subscribed to receive notifications of events of type GameStart
. Each time one of these events is received, we will post a message on the console as an answer:
Last updated