Class UniverseBase<TCoordinates>
- Namespace
- AlphaFramework.World
- Assembly
- AlphaFramework.World.dll
A common base for game worlds (but not a running game). Equivalent to the content of a map file.
public abstract class UniverseBase<TCoordinates> : IUniverse where TCoordinates : struct
Type Parameters
TCoordinates
Data type for storing position coordinates of objects in the game world.
- Inheritance
-
UniverseBase<TCoordinates>
- Implements
- Derived
- Inherited Members
- Extension Methods
Properties
CurrentCamera
The current position and direction of the camera in the game.
[Browsable(false)]
public CameraState<TCoordinates>? CurrentCamera { get; set; }
Property Value
- CameraState<TCoordinates>
Remarks
This is updated only when leaving the game, not continuously.
GameTime
Total elapsed game time in seconds.
public double GameTime { get; set; }
Property Value
Pathfinder
The pathfinding engine used to navigate Positionables.
[Browsable(false)]
public IPathfinder<TCoordinates>? Pathfinder { get; set; }
Property Value
- IPathfinder<TCoordinates>
Positionables
A collection of all Positionable<TCoordinates>s in this UniverseBase<TCoordinates>.
[Browsable(false)]
public abstract MonitoredCollection<Positionable<TCoordinates>> Positionables { get; }
Property Value
- MonitoredCollection<Positionable<TCoordinates>>
Skybox
The name of the skybox to use for this map; may be null
or empty.
public string? Skybox { get; set; }
Property Value
SourceFile
The map file this world was loaded from.
[Browsable(false)]
public string SourceFile { get; set; }
Property Value
Remarks
Is not serialized/stored, is set by whatever method loads the universe.
Methods
Save()
Overwrites the map file this UniverseBase<TCoordinates> was loaded from with the changed data.
public void Save()
Exceptions
- IOException
A problem occurred while writing the file.
- UnauthorizedAccessException
Write access to the file is not permitted.
Save(string)
Saves this UniverseBase<TCoordinates> in a compressed XML file (map file).
public abstract void Save(string path)
Parameters
path
stringThe file to save in.
Exceptions
- IOException
A problem occurred while writing the file.
- UnauthorizedAccessException
Write access to the file is not permitted.
Update(IUpdateable, double)
Updates a single IUpdateable.
protected virtual void Update(IUpdateable updateable, double elapsedGameTime)
Parameters
updateable
IUpdateableelapsedGameTime
double
Update(double)
Updates the UniverseBase<TCoordinates> and all Positionable<TCoordinates>s in it.
public virtual void Update(double elapsedGameTime)
Parameters
elapsedGameTime
doubleHow much game time in seconds has elapsed since this method was last called.
Events
SkyboxChanged
Occurs when Skybox was changed.
public event Action? SkyboxChanged