Class Session<TUniverse>
- Namespace
- AlphaFramework.World
- Assembly
- AlphaFramework.World.dll
A common base for game sessions (i.e. a game actually being played).
public class Session<TUniverse> where TUniverse : class, IUniverse
Type Parameters
TUniverseThe specific type of IUniverse stored in the session.
- Inheritance
-
Session<TUniverse>
- Derived
- Inherited Members
- Extension Methods
Constructors
Session()
Base-constructor for XML serialization. Do not call manually!
protected Session()
Session(TUniverse)
Creates a new game session based upon a given universe
protected Session(TUniverse baseUniverse)
Parameters
baseUniverseTUniverseThe universe to base the new game session on.
Properties
MapSourceFile
The filename of the map file the Universe was loaded from.
public string? MapSourceFile { get; set; }
Property Value
TimeWarpFactor
The factor by which GameTime progression should be multiplied in relation to real time.
public double TimeWarpFactor { get; set; }
Property Value
Universe
The current state of the game world.
[LuaHide]
public TUniverse Universe { get; set; }
Property Value
- TUniverse
Methods
Save(string)
Saves this session in an XML file (savegame).
public virtual void Save(string path)
Parameters
pathstringThe file to save in.
Exceptions
- IOException
A problem occurred while writing the file.
- UnauthorizedAccessException
Write access to the file is not permitted.
Update(double)
Updates the underlying Universe.
public virtual double Update(double elapsedRealTime)
Parameters
elapsedRealTimedoubleHow much real time in seconds has elapsed since this method was last called.
Returns
- double
The elapsed game time (real time multiplied by TimeWarpFactor)