Table of Contents

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

string

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

Color

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

XColor
See Also

Bleach

Is the fog active?

public bool Bleach { get; set; }

Property Value

bool

ColorCorrectionDawn

Color correction values to apply at dawn.

public ColorCorrection ColorCorrectionDawn { get; set; }

Property Value

ColorCorrection

ColorCorrectionDusk

Color correction values to apply at dusk.

public ColorCorrection ColorCorrectionDusk { get; set; }

Property Value

ColorCorrection

ColorCorrectionMidnight

Color correction values to apply at midnight.

public ColorCorrection ColorCorrectionMidnight { get; set; }

Property Value

ColorCorrection

ColorCorrectionNoon

Color correction values to apply at noon.

public ColorCorrection ColorCorrectionNoon { get; set; }

Property Value

ColorCorrection

Fog

Is the fog active?

public bool Fog { get; set; }

Property Value

bool

FogColor

The color of the fog.

public Color FogColor { get; set; }

Property Value

Color

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

XColor
See Also

FogDistance

The maximum distance one can look through the fog.

public float FogDistance { get; set; }

Property Value

float

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

float

LightPhaseSpeedFactor

The speed with which the LightPhase is incremented.

public float LightPhaseSpeedFactor { get; set; }

Property Value

float

MaxTraversableSlope

The maximum slope the IPathfinder<TCoordinates> considers traversable.

public int MaxTraversableSlope { get; set; }

Property Value

int

MoonColor

The color of the diffuse light (normal directional light) of the second moon.

public Color MoonColor { get; set; }

Property Value

Color

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

XColor
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

float

Positionables

[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

Color

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

XColor
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

float

Terrain

The Terrain on which Entitys are placed.

[Browsable(false)]
public Terrain<TerrainTemplate>? Terrain { get; set; }

Property Value

Terrain<TerrainTemplate>

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

Terrain<TerrainTemplate>

Methods

FromContent(string)

Loads a Universe from the game content source via the ContentManager.

public static Universe FromContent(string id)

Parameters

id string

The ID of the Universe to load.

Returns

Universe

The loaded Universe.

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

Entity

The first matching Entity; null if there is no match.

GetTrigger(string)

Retrieves an Trigger from Positionables by its name.

public Trigger? GetTrigger(string name)

Parameters

name string

Returns

Trigger

The first matching Trigger; null if there is no match.

Load(string)

Loads a Universe from a compressed XML file (map file).

public static Universe Load(string path)

Parameters

path string

The file to load from.

Returns

Universe

The loaded Universe.

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 Entity
target Vector2

Save(string)

Saves this UniverseBase<TCoordinates> in a compressed XML file (map file).

public override void Save(string path)

Parameters

path string

The 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 IUpdateable
elapsedGameTime double

Update(double)

public override void Update(double elapsedGameTime)

Parameters

elapsedGameTime double

How much game time in seconds has elapsed since this method was last called.

Events

LightingChanged

public event Action? LightingChanged

Event Type

Action