This page has been translated automatically.
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
Samples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Content Creation
Materials
Unigine Material Library
Tutorials
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

MasterGame Class

The MasterGame class controls the frameworks and the game itself. Levels are loaded and reloaded by using this class.

The implementation of the MasterGame class can be found in the data/framework/game/master_game.h file.

MasterGame Class

Members


MasterGame (string game_path)

Constructor. Creates a new MasterGame class instance.

Arguments

  • string game_path - Path to the *.game file.

void update ()

Toggles between game levels. You can switch the level by pressing CTRL + number, where number takes on the values from 0 to 9.
Notice
This function is useful during the game development only.

void shutdown ()

Stops the work of the MasterGame class.

int getNumLevels ()

Returns a number of game levels.

Return value

Number of game levels.

void loadLevel (variable index)

Loads a level.

Arguments

  • variable index - Level number if index is an integer; level name if index is a string.

int getActiveLevelIndex ()

Returns a level index of the loaded game .

Return value

Level index.

string getActiveLevelName ()

Returns a level name of the loaded game.

Return value

Level name.

void setGameParameter (string name, variable value)

Sets a game custom parameter.

Arguments

  • string name - Unique parameter name.
  • variable value - Parameter value. The value can be the following types: int, float, double, vec3, vec4, string.

variable getGameParameter (string name)

Returns a custom parameter value.

Arguments

  • string name - Parameter name.

Return value

Custom parameter value if it is found; otherwise 0.

variable getGameParameter (string name, int default_value)

Returns a parameter value.

Arguments

  • string name - Parameter name.
  • int default_value - Default value.

Return value

Custom parameter value if it is found; otherwise a default value.

int isGameParameter (string name)

Returns a value indicating if the game parameter exists.

Arguments

  • string name - Parameter name.

Return value

1 if the parameter exists; otherwise 0.
Last update: 2017-07-03
Build: ()