Scripts - GameLabGraz/Maroon GitHub Wiki


Guidelines

  • If a script/shader visualizes or interacts with a 3d object, the script/shader should not depend on a (hard-coded) positioning and rotation of the object. It should work even if the object is re-positioned and rotated within the experiment room.

  • Scripts use UNIX style line endings (LF terminated)

:warning: Deprecated: The line ending type was decided based on what was used in Unity default scripts, this seems to have changed since v2019. This needs to be revisited.

Global Entities

Global entities are prefabs accompanied by scripts that are loaded in every scene. All global entities should be singletons, so that there can only be one instance of them. Global entities are also not re-loaded on every scene load. If loaded once, they stay active until Maroon gets closed.

GlobalEntityLoader

The GlobalEntities prefab has to be placed in every scene that should automatically load all global entities. The GlobalEntityLoader is responsible for instantiating the global entities.

BootstrappingManager

The BootstrappingManager is responsible for setting up Maroon. It handles initial tasks such as detecting the VR state, checking the URL parameters in the WebGL build or loading the first scene after the bootstrapping scene.

SceneManager

The SceneManager (in conjunction with the CustomSceneAsset, SceneCategory and SceneType) is responsible for handling tasks related to scenes in Maroon, including finding scene categories, scene assets, loading scenes, and keeping track of previously loaded scenes. In the prefab of the SceneManager the scenes are assigned to scene categories. The laboratories are generated according to these scene categories.

Note: The CustomSceneAsset was created because the Unity scene asset is only available in the editor, so it is not usable in the player. The CustomSceneAsset is just a PropertyDrawer. That means that the equal operator will not work. Compare the name or path property of the CustomSceneAsset instead!

GameManager

The GameManager should be responsible for basic global game states. Unfortunately it is a conglomerate of things that should either be moved to one of the other managers or deleted because it is not in use anymore.

LanguageManager

The LanguageManager is responsible for the localization of Maroon. It is not a global entity yet and has to be converted.

SoundManager

The SoundManager is responsible for audio settings, common sound effects and common music in Maroon.

NetworkManager

The NetworkManager is responsible for the networking (multiplayer, communication with the list server and other players) in Maroon. It is not a global entity that is loaded automatically yet and has to be converted.

WebGLUrlParameterReader

The WebGLUrlParameterReader is responsible for reading the parameters of the URL in the WebGL build. It is not a typical global entity, as it is implemented as a JavaScript plugin and a static function to communicate with the JS plugin.