Class Universe
- Namespace
- FrameOfReference.World
- Assembly
- FrameOfReference.World.dll
Represents a world with a height-map based Terrain.
public sealed class Universe : UniverseBase<Vector2>, IUniverse
- Inheritance
-
UniverseBase<Vector2>Universe
- Implements
- Inherited Members
- Extension Methods
Constructors
Universe()
Base-constructor for XML serialization. Do not call manually!
public Universe()
Universe(Terrain<TerrainTemplate>)
Creates a new Universe with a terrain.
public Universe(Terrain<TerrainTemplate> terrain)
Parameters
terrain
Terrain<TerrainTemplate>The terrain for the new Universe.
Fields
FileExt
The file extensions when this class is stored as a file.
public const string FileExt = ".FrameOfReferenceMap"
Field Value
Properties
AmbientColor
The color of the ambient light (background light that is always visible and has no direction).
public Color AmbientColor { get; set; }
Property Value
Remarks
Is not serialized/stored, AmbientColorValue is used for that.
AmbientColorValue
Used for XML serialization.
[LuaHide]
[Browsable(false)]
public XColor AmbientColorValue { get; set; }
Property Value
- See Also
Bleach
Is the fog active?
public bool Bleach { get; set; }
Property Value
ColorCorrectionDawn
Color correction values to apply at dawn.
public ColorCorrection ColorCorrectionDawn { get; set; }
Property Value
ColorCorrectionDusk
Color correction values to apply at dusk.
public ColorCorrection ColorCorrectionDusk { get; set; }
Property Value
ColorCorrectionMidnight
Color correction values to apply at midnight.
public ColorCorrection ColorCorrectionMidnight { get; set; }
Property Value
ColorCorrectionNoon
Color correction values to apply at noon.
public ColorCorrection ColorCorrectionNoon { get; set; }
Property Value
Fog
Is the fog active?
public bool Fog { get; set; }
Property Value
FogColor
The color of the fog.
public Color FogColor { get; set; }
Property Value
Remarks
Is not serialized/stored, FogColorValue is used for that.
FogColorValue
Used for XML serialization.
[LuaHide]
[Browsable(false)]
public XColor FogColorValue { get; set; }
Property Value
- See Also
FogDistance
The maximum distance one can look through the fog.
public float FogDistance { get; set; }
Property Value
LightPhase
A value between 0 and 4 representing the current sun and moon positions. (0 = dawn, 1 = noon, 2 = dusk, 3 = midnight)
[FloatRange(0, 4)]
public float LightPhase { get; set; }
Property Value
LightPhaseSpeedFactor
The speed with which the LightPhase is incremented.
public float LightPhaseSpeedFactor { get; set; }
Property Value
MaxTraversableSlope
The maximum slope the IPathfinder<TCoordinates> considers traversable.
public int MaxTraversableSlope { get; set; }
Property Value
MoonColor
The color of the diffuse light (normal directional light) of the second moon.
public Color MoonColor { get; set; }
Property Value
Remarks
Is not serialized/stored, MoonColorValue is used for that.
MoonColorValue
Used for XML serialization.
[LuaHide]
[Browsable(false)]
public XColor MoonColorValue { get; set; }
Property Value
- See Also
MoonInclination
The angle of inclination of the second moon's path away from the horizon towards south in degrees.
public float MoonInclination { get; set; }
Property Value
Positionables
A collection of all Positionable<TCoordinates>s in this UniverseBase<TCoordinates>.
[Browsable(false)]
public override MonitoredCollection<Positionable<Vector2>> Positionables { get; }
Property Value
- MonitoredCollection<Positionable<Vector2>>
SunColor
The color of the diffuse light (normal directional light) of the sun.
public Color SunColor { get; set; }
Property Value
Remarks
Is not serialized/stored, SunColorValue is used for that.
SunColorValue
Used for XML serialization.
[LuaHide]
[Browsable(false)]
public XColor SunColorValue { get; set; }
Property Value
- See Also
SunInclination
The angle of inclination of the sun's path away from the horizon towards south in degrees.
public float SunInclination { get; set; }
Property Value
Terrain
[Browsable(false)]
public Terrain<TerrainTemplate>? Terrain { get; set; }
Property Value
Remarks
Is not serialized/stored, TerrainSerialize is used for that.
Exceptions
- InvalidOperationException
The Terrain could not be properly loaded from the file.
TerrainSerialize
Used for XML serialization.
[LuaHide]
[Browsable(false)]
public Terrain<TerrainTemplate>? TerrainSerialize { get; set; }
Property Value
Methods
FromContent(string)
Loads a Universe from the game content source via the ContentManager.
public static Universe FromContent(string id)
Parameters
Returns
GetCamera(string)
Retrieves an CameraState<TCoordinates> from Positionables by its name.
public CameraState<Vector2>? GetCamera(string name)
Parameters
name
string
Returns
- CameraState<Vector2>
The first matching CameraState<TCoordinates>;
null
if there is no match.
GetEntity(string)
Retrieves an Entity from Positionables by its name.
public Entity? GetEntity(string name)
Parameters
name
string
Returns
GetTrigger(string)
Retrieves an Trigger from Positionables by its name.
public Trigger? GetTrigger(string name)
Parameters
name
string
Returns
Load(string)
Loads a Universe from a compressed XML file (map file).
public static Universe Load(string path)
Parameters
path
stringThe file to load from.
Returns
Exceptions
- IOException
A problem occurred while reading the file.
- UnauthorizedAccessException
Read access to the file is not permitted.
- InvalidOperationException
A problem occurred while deserializing the XML data.
MakeAllNpc()
Turns all Entitys into NPCs.
public void MakeAllNpc()
MakePlayerControlled(string)
Turns a specific Entity into a player-controlled character.
public void MakePlayerControlled(string name)
Parameters
name
string
Exceptions
- KeyNotFoundException
Entity not found.
PlayerMove(Entity, Vector2)
Makes a player-controlled Entity move towards a target
.
public void PlayerMove(Entity entity, Vector2 target)
Parameters
entity
Entitytarget
Vector2
Save(string)
Saves this UniverseBase<TCoordinates> in a compressed XML file (map file).
public override 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.
UnwrapWaypoints()
Moves Waypoint from Waypoints to Positionables. Call to prepare for editing.
public void UnwrapWaypoints()
Update(IUpdateable, double)
Updates a single IUpdateable.
protected override void Update(IUpdateable updateable, double elapsedGameTime)
Parameters
updateable
IUpdateableelapsedGameTime
double
Update(double)
Updates the UniverseBase<TCoordinates> and all Positionable<TCoordinates>s in it.
public override void Update(double elapsedGameTime)
Parameters
elapsedGameTime
doubleHow much game time in seconds has elapsed since this method was last called.
Events
LightingChanged
Occurs when LightPhase, AmbientColor, SunColor, ColorCorrectionDawn, ColorCorrectionNoon or ColorCorrectionDusk, ColorCorrectionMidnight was changed.
public event Action? LightingChanged