Enfusion Script API
|
Public Member Functions | |
sealed BaseWorld | GetWorld () |
sealed InputManager | GetInputManager () |
sealed MenuManager | GetMenuManager () |
sealed WorkspaceWidget | GetWorkspace () |
proto external string | GetWorldFile () |
Returns path of world file loaded. | |
proto external GameWorldEditor | GetWorldEditor () |
Returns the world editor. | |
proto external void | StartCinematic (string name) |
proto external void | StopCinematic () |
proto external bool | IsPlayingCinematic () |
proto external UserSettings | GetEngineUserSettings () |
Returns UserSettings container for Engine User Settings. | |
proto external UserSettings | GetGameUserSettings () |
Returns UserSettings container for Game User Settings. | |
proto external void | ApplySettingsPreset () |
Apply setting preset according to DisplayUserSettings.OverallQuality. | |
proto external void | UserSettingsChanged () |
Notify engine about changes in Engine User Settings. | |
proto external void | SaveUserSettings () |
Save Engine User Settings to permanent storage. | |
proto external bool | IsSaveStorageAvailable () |
Determines the availability of save storage. | |
proto external BackendApi | GetBackendApi () |
Backend Api access class. | |
proto external BackendDebugApi | GetBackendDebugApi () |
proto external RestApi | GetRestApi () |
RESTful Api request access class. | |
proto external bool | BeginPreload (notnull BaseWorld world, vector pos, float radius, int maxTime_sec=60) |
Begin preloading on given position with given radius. | |
proto external bool | IsPreloadFinished () |
If preload (started with BeginPreload method) is finished, returns true. | |
proto external int | GetLoadTime () |
Returns load time in milliseconds for the lastly loaded world. | |
proto external void | RequestClose () |
Setting request flag for engine to exit the game. | |
proto external string | GetBuildVersion () |
Returns version of the game. | |
proto external string | GetBuildTime () |
Returns date and time when the game was built. | |
proto external GenericWorldEntity | GetWorldEntity () |
Returns path of world file loaded. | |
proto external IEntity | FindEntity (string name) |
proto external bool | InPlayMode () |
Checks if the game is in playmode (e.g. | |
proto external int | ReloadFailureAddons (out notnull array< string > addons) |
proto external ScriptModule | GetScriptModule () |
proto external PlatformService | GetPlatformService () |
proto external void | RequestReload (array< string > addonGUIDs=null) |
Setting request flag for the engine to reinitialize the game Doesn't do anything in Workbench. | |
proto external IEntity | SpawnEntity (TypeName typeName, BaseWorld world=null, EntitySpawnParams params=null) |
Safely instantiate the entity and calls EOnInit if the entity sets event mask EntityEvent.INIT. | |
proto external IEntity | SpawnEntityPrefab (notnull Resource templateResource, BaseWorld world=null, EntitySpawnParams params=null) |
Safely instantiate the entity from template (with all components) and calls EOnInit if the entity sets event mask EntityEvent.INIT. | |
TypeName | GetMenuPreset () |
LoadingAnim | CreateLoadingAnim (WorkspaceWidget workspaceWidget) |
Creates handler for loading screen, its animation and resources. | |
void | OnUpdate (BaseWorld world, float timeslice) |
Called on World update. | |
void | OnAfterInit (BaseWorld world) |
Called after full initialization of Game instance. | |
bool | OnGameStart () |
Event which is called right before game starts (all entities are created and initialized). | |
void | OnGameEnd () |
Event which is called right before game end. | |
void | OnEvent (EventType eventTypeId, Tuple params) |
Called when some system event occur. | |
void | OnUserSettingsChangedEvent () |
Event which is called when user change settings. | |
void | OnInputDeviceUserChangedEvent (EInputDeviceType oldDevice, EInputDeviceType newDevice) |
Event which is called when input device binded to user changed. | |
void | OnInputDeviceIsGamepadEvent (bool isGamepad) |
Event which is called when input device binded to user changes between gamepad and keyboard/mouse, ignoring Joystick and TrackIR. | |
void | OnWorldPostProcess (World world) |
Event called once loading of all entities of the world have been finished. | |
void | OnWorldSimulatePhysics (float timeSlice) |
Event which is called before each fixed step of the physics simulation. | |
void | OnWorldPostSimulatePhysics (float timeSlice) |
void | OnWindowResize (int w, int h, bool windowed) |
Event which is called when window size of fullscreen state changed. | |
void | HostGameConfig () |
Called after reload to host a modded scenario. | |
void | PlayGameConfig (ResourceName sResource, string addonsList) |
ref array< ResourceName > | GetDefaultGameConfigs () |
Managed | ReadGameConfig (string sResource) |
void | OnGamepadConnectionStatus (bool isConnected) |
Event which is called on Gamepad Connection/Disconnection. | |
Static Public Member Functions | |
static proto bool | IsDev () |
Return true if executable is developer build. | |
Protected Attributes | |
BaseWorld | m_World |
InputManager | m_InputManager |
MenuManager | m_MenuManager |
WorkspaceWidget | m_WorkspaceWidget |
proto external void Game.ApplySettingsPreset | ( | ) |
Apply setting preset according to DisplayUserSettings.OverallQuality.
proto external bool Game.BeginPreload | ( | notnull BaseWorld | world, |
vector | pos, | ||
float | radius, | ||
int | maxTime_sec = 60 |
||
) |
Begin preloading on given position with given radius.
Call is non-blocking, to get status of preload use IsPreloadFinished method.
world | |
pos | Position of place which to preload |
radius | Radius of area which to preload |
maxTime_sec | Maximum duration of preload in seconds <0, 300> |
LoadingAnim Game.CreateLoadingAnim | ( | WorkspaceWidget | workspaceWidget | ) |
Creates handler for loading screen, its animation and resources.
Override this in your Game implementation to customize loading screen look and behavior. Default implementation does nothing.
[in] | workspaceWidget | The workspace widget used by the loading screen. LoadingAnim implementation may only use this WorkspaceWidget to work with UI. |
proto external BackendApi Game.GetBackendApi | ( | ) |
Backend Api access class.
proto external BackendDebugApi Game.GetBackendDebugApi | ( | ) |
proto external string Game.GetBuildTime | ( | ) |
Returns date and time when the game was built.
proto external string Game.GetBuildVersion | ( | ) |
Returns version of the game.
ref array< ResourceName > Game.GetDefaultGameConfigs | ( | ) |
proto external UserSettings Game.GetEngineUserSettings | ( | ) |
Returns UserSettings container for Engine User Settings.
proto external UserSettings Game.GetGameUserSettings | ( | ) |
Returns UserSettings container for Game User Settings.
sealed InputManager Game.GetInputManager | ( | ) |
proto external int Game.GetLoadTime | ( | ) |
Returns load time in milliseconds for the lastly loaded world.
sealed MenuManager Game.GetMenuManager | ( | ) |
TypeName Game.GetMenuPreset | ( | ) |
proto external PlatformService Game.GetPlatformService | ( | ) |
proto external RestApi Game.GetRestApi | ( | ) |
RESTful Api request access class.
proto external ScriptModule Game.GetScriptModule | ( | ) |
sealed WorkspaceWidget Game.GetWorkspace | ( | ) |
sealed BaseWorld Game.GetWorld | ( | ) |
proto external GameWorldEditor Game.GetWorldEditor | ( | ) |
Returns the world editor.
IMPORTANT* Only works when InPlayMode is false
proto external GenericWorldEntity Game.GetWorldEntity | ( | ) |
Returns path of world file loaded.
proto external string Game.GetWorldFile | ( | ) |
Returns path of world file loaded.
void Game.HostGameConfig | ( | ) |
Called after reload to host a modded scenario.
proto external bool Game.InPlayMode | ( | ) |
Checks if the game is in playmode (e.g.
not in WorldEditor while editing the world)
|
static |
Return true if executable is developer build.
proto external bool Game.IsPlayingCinematic | ( | ) |
proto external bool Game.IsPreloadFinished | ( | ) |
If preload (started with BeginPreload method) is finished, returns true.
proto external bool Game.IsSaveStorageAvailable | ( | ) |
Determines the availability of save storage.
Game can try to call PlatformService::ObtainSaveDataAsync() which would reinitilize the storage access if possible.
void Game.OnGameEnd | ( | ) |
Event which is called right before game end.
void Game.OnGamepadConnectionStatus | ( | bool | isConnected | ) |
Event which is called on Gamepad Connection/Disconnection.
isConnected | is false on disconnection, true on re-connection. |
bool Game.OnGameStart | ( | ) |
Event which is called right before game starts (all entities are created and initialized).
Returns true if the game can start.
void Game.OnInputDeviceIsGamepadEvent | ( | bool | isGamepad | ) |
Event which is called when input device binded to user changes between gamepad and keyboard/mouse, ignoring Joystick and TrackIR.
void Game.OnInputDeviceUserChangedEvent | ( | EInputDeviceType | oldDevice, |
EInputDeviceType | newDevice | ||
) |
Event which is called when input device binded to user changed.
Called on World update.
world | current world |
timeslice | time elapsed from last call |
void Game.OnUserSettingsChangedEvent | ( | ) |
Event which is called when user change settings.
Event which is called when window size of fullscreen state changed.
w | new width of window in screen pixels |
h | new height of window in screen pixels |
windowed | true when is windowed, false then fullscreen |
void Game.OnWorldPostProcess | ( | World | world | ) |
Event called once loading of all entities of the world have been finished.
(still within the loading)
void Game.OnWorldPostSimulatePhysics | ( | float | timeSlice | ) |
void Game.OnWorldSimulatePhysics | ( | float | timeSlice | ) |
Event which is called before each fixed step of the physics simulation.
timeSlice | simulation step length |
void Game.PlayGameConfig | ( | ResourceName | sResource, |
string | addonsList | ||
) |
proto external void Game.RequestClose | ( | ) |
Setting request flag for engine to exit the game.
Setting request flag for the engine to reinitialize the game Doesn't do anything in Workbench.
proto external void Game.SaveUserSettings | ( | ) |
Save Engine User Settings to permanent storage.
proto external IEntity Game.SpawnEntity | ( | TypeName | typeName, |
BaseWorld | world = null , |
||
EntitySpawnParams | params = null |
||
) |
Safely instantiate the entity and calls EOnInit if the entity sets event mask EntityEvent.INIT.
typeName | Name of entity's type to instantiate. |
proto external IEntity Game.SpawnEntityPrefab | ( | notnull Resource | templateResource, |
BaseWorld | world = null , |
||
EntitySpawnParams | params = null |
||
) |
Safely instantiate the entity from template (with all components) and calls EOnInit if the entity sets event mask EntityEvent.INIT.
templateResource | Template resource of the entity to instantiate. |
proto external void Game.StartCinematic | ( | string | name | ) |
proto external void Game.StopCinematic | ( | ) |
proto external void Game.UserSettingsChanged | ( | ) |
Notify engine about changes in Engine User Settings.
|
protected |
|
protected |
|
protected |
|
protected |