Table of Contents

Class Game

Namespace
FrameOfReference
Assembly
FrameOfReference.dll

Represents a running instance of the game

public class Game : GameBase, IDisposable
Inheritance
Game
Implements
Inherited Members
Extension Methods

Constructors

Game(Settings)

Represents a running instance of the game

public Game(Settings settings)

Parameters

settings Settings

Properties

CurrentPresenter

The currently active presenter

[LuaHide]
public Presenter? CurrentPresenter { get; }

Property Value

Presenter

CurrentSession

The current game session

[LuaHide]
public Session? CurrentSession { get; }

Property Value

Session

CurrentState

The current state of the game

[LuaHide]
public GameState CurrentState { get; }

Property Value

GameState

Methods

Dispose(bool)

To be called by Dispose() and the object destructor.

protected override void Dispose(bool disposing)

Parameters

disposing bool

true if called manually and not by the garbage collector.

GetElapsedGameTime(double)

Determines the amount of elapsed game time from the amount of elapsed real time.

protected override double GetElapsedGameTime(double elapsedTime)

Parameters

elapsedTime double

Returns

double

GetSavegameNames()

Lists the names of all stored Sessions.

public IEnumerable<string> GetSavegameNames()

Returns

IEnumerable<string>

Initialize()

To be called after the window is ready and the Engine needs to be set up

protected override bool Initialize()

Returns

bool

true if the initialization worked, false if it failed and the app must be closed

LoadMap(string)

Loads a game map into CurrentSession and switches the CurrentState to InGame

public void LoadMap(string name)

Parameters

name string

The name of the map to load

LoadMenu(string)

Loads a map into FrameOfReference.Game._menuUniverse and switches the CurrentState to Menu

public void LoadMenu(string name)

Parameters

name string

The name of the map to load

LoadSavegame(string)

Loads a savegame from user's profile to replace the CurrentSession.

public void LoadSavegame(string name)

Parameters

name string

The name of the savegame to load.

ModifyMap(string)

Loads a game map into CurrentSession and switches the CurrentState to Modify

public void ModifyMap(string name)

Parameters

name string

The name of the map to load

NewLua()

Creates a new LuaInterface.Lua instance with commonly used objects preloaded.

[LuaHide]
public override Lua NewLua()

Returns

Lua

Run()

Shows the window and runs the render loop until Exit() is called.

[LuaHide]
public override void Run()

SaveSavegame(string)

Saves the CurrentSession as a savegame stored in the user's profile.

public void SaveSavegame(string name)

Parameters

name string

The name of the savegame to write.

SwitchToGame()

Switches the game to in-game mode

public void SwitchToGame()

Remarks

If CurrentState is already InGame, nothing will happen. Loading may take a while, subsequent calls will be a bit faster because the Engine cache will still be hot

SwitchToMenu()

Switches to the main menu

public void SwitchToMenu()

Remarks

If CurrentState is already Menu, nothing will happen. Loading will take a while on first call, subsequent calls will be very fast, because FrameOfReference.Game._menuUniverse is preserved

SwitchToModify()

Switches the game to map modification mode

public void SwitchToModify()

Remarks

If CurrentState is already Modify, nothing will happen. Loading may take a while, subsequent calls will be a bit faster because the Engine cache will still be hot

TogglePause()

Toggles CurrentState between InGame and Pause

public void TogglePause()

Remarks

When called while CurrentState is neither InGame nor Pause nothing happens