This page has been translated automatically.
Getting Started
Migrating to UNIGINE 2.0
C++ API Migration
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

EventSystem Class

The EventSystem class provides an event system work.

The EventSystem class implementation can be found in the data/framework/game/event_system.h file.

EventSystem Class

Members


EventSystem ()

Constructor. Creates a new EventSystem class instance.

void createEvent (string name)

Creates an event.

Arguments

  • string name - Unique event name.

void removeEvent (string name)

Deletes an event.

Arguments

  • string name - Unique event name.

int isEvent (string name)

Returns a value indicating if an event with a specified name exists.

Arguments

  • string name - Event name.

Return value

1 if an event exists; otherwise 0.

void setEventEnabled (string name, int mode)

Sets a value indicating if an event enabled or disabled.

Arguments

  • string name - Event name.
  • int mode - 1 to enable an event; 0 to disable it.

int isEventEnabled (string name)

Returns a value indicating if an event is enabled.

Arguments

  • string name - Event name.

Return value

1 if an event is enabled; otherwise 0.

void callEvent (string name)

Calls an event.

Arguments

  • string name - Event name.

void callEvent (string name, Entity ret [])

Calls an event for the specified entities.

Arguments

  • string name - Event name.
  • Entity ret [] - Array of entities.

void subscribe (string name, variable instance, string function, variable arg0 = 0, variable arg1 = 0, variable arg2 = 0, variable arg3 = 0)

Subscribes a function to an event.

Arguments

  • string name - Event name.
  • variable instance - User class instance, for which the function is called. If the function is static, pass the NULL value.
  • string function - Name of the function that is called when the event occures.
  • variable arg0 - Function argument, optional.
  • variable arg1 - Function argument, optional.
  • variable arg2 - Function argument, optional.
  • variable arg3 - Function argument, optional.

void unsubscribe (string name, variable instance, string function, int num_args = 0)

Unsubscribes a function from an event.

Arguments

  • string name - Event name.
  • variable instance - User class instance, for which the function is called. If the function is static, pass the NULL value.
  • string function - Name of the function.
  • int num_args - Number of function arguments.

void clearGarbage ()

Releases an event system unused resources.
Last update: 2017-07-03
Build: ()