WorldManager Class

Summary

WorldManager API (WAPI) allows you to control the components that render your environment a generic and coordinated way. The intention is to bridge the gap between assets and make it easier to develop games by plugging them together using a common API. You will still configure assets individually to your own taste, but coordination and control is generic and centralised. Assets can choose which parts of the API they implement and regardless of how much they support, you will still get value from this system because of the way it coordinates their behaviour. To generate events, and get and set values use the following generic format e.g. WorldManager.Instance.Api() To receive events when values are changed implement your own listener via the IWorldApiChangeHandler interface and then connect it up WorldManager.Instance.AddListener(this); To stop receiving events when values change disconnect your handler e.g. WorldManager.Instance.RemoveListener(this); To shut everything down and start it up again use WorldAPIActive e.g. WorldManager.Instance.WorldAPIActive = false; To use as global variables in shaders the general naming standard is _WAPI_[PropertyName], however in many instances the data has been stored in vectors for efficient transfer to the GPU, so take a peek at the code to get the naming. At the very least however all shader variables are prefixed with _WAPI_.
Namespace
WAPI
Base Types
  • MonoBehaviour
graph BT Type-->Base0["MonoBehaviour"] Type["WorldManager"] class Type type-node

Syntax

public sealed class WorldManager : MonoBehaviour

Properties

Name Value Summary
CloudMaxHeight float
Maximim cloud height in world units / meters
CloudMinHeight float
Minimum cloud height in world units / meters
CloudPower float
Cloud power - in range 0 .. 1
Clouds Vector4
Get and set clouds - x = CloudPower, y = CloudMinHeight, z = CloudMaxHeight, w = CloudSpeed
CloudSpeed float
Speed the clouds are travelling at in meters /sec
Extensions List<WorldManagerDataExtension>
Extension data - store whatever you want here - if there is something in here thats not yours then dont touch it, as it will depend on this in some way.
Fog Vector4
Get and set fog, x = FogHeightPower, y = FogHeightMax, z = FogDistancePower, w = FogDistanceMax
FogDistanceMax float
Maximum fog distance in world units / meters
FogDistancePower float
Fog distance power 0..1
FogHeightMax float
Maximum height for height based fog in world units / meters
FogHeightPower float
Fog height power - in range 0 .. 1
GameTime DateTime
Current game date and time
Hail Vector4
Get and set hail- x = HailPower, y = HailPowerOnTerrain, z = MinHailHeight, w = MaximumHailHeight
HailMaxHeight float
Maximum hail height in world units / meters
HailMinHeight float
Minimum hail height in world units / meters
HailPower float
Hail power - in range 0 .. 1
HailPowerTerrain float
Hail power on terrain 0..1
Humidity float
Humidity
Instance WorldManager
static
Latitude float
Latitude
Longitude float
Longitude
MoonPhase float
Moon phase 0 none .. 1 full
PlayerObject GameObject
Player object - the player / object that holds the main game camera
Rain Vector4
Get and set rain - x = RainPower, y = RainPowerOnTerrain, z = RainMinHeight, w = RainMaxHeight
RainMaxHeight float
Maximum rain height in world units / meters
RainMinHeight float
Minimum rain height in world units / meters
RainPower float
Rain power - in range 0 .. 1
RainPowerTerrain float
Rain power on terrain - in range 0 .. 1
SceneCenter Vector3
Center of scene in world units - useful for placement
SceneGroundCenter Vector3
Ground level at center of scene in world units - useful for placement
SceneSize Vector3
Size of the scene in world units - useful for placement
SeaLevel float
Sea Level - world units
Season float
Season
Snow Vector4
Get and set all snow, x = SnowPower, y = SnowPowerOnTerrain, z = SnowMinHeight, w = SnowAge
SnowAge float
Snow age 0 fresh.. 1 old / crystalized
SnowMinHeight float
Minimum snow height in world units / meters
SnowPower float
Snow power - in range 0 .. 1
SnowPowerTerrain float
Snow power on terrain in range 0..1
Temperature float
Temperature degrees centigrade
ThunderPower float
Thunder power - in range 0 .. 1
Volume Vector4
Sound volumes, x = VolumeEnvironment, y = VolumeNPC, z = VolumeAnimals, w = VolumeWeather
VolumeAnimals float
Animal Volume
VolumeEnvironment float
Global environment volume
VolumeNPC float
NPC volume
VolumeWeather float
Weather Volume
Wind Vector4
Get and set wind - x = WindDirection, y = WindSpeed, z = WindTurbulence
WindDirection float
Wind direction 0..360f
WindSpeed float
Wind speed m/sec
WindTurbulence float
Wind turbulence
WorldAPIActive bool
Whether or not the world api is active

Methods

Name Value Summary
AddListener(IWorldApiChangeHandler) void
Add your listener
DeSerialise(string) void
Deserialise the content of the world manager from the supplied string
GetTimeDecimal() double
Get time in scientific decimal format accurate to millisecond 0.0000 .. 23.9999 ie hours.minutessecsmillisecs
RemoveListener(IWorldApiChangeHandler) void
Remove your listener
Serialise() string
Serialise the content of world manager into a JSON string
SetDecimalTime(double) void
Set the decimal time eg 0.. 23.99: