Skip to main content

AtmospherePlugin

An abstract class in Root.Township, Alta.Environmental.Atmosphere.

Base for an atmosphere source (such as a zone or weather) that supplies ambient light, fog and ambience audio. The AtmosphereManager initializes plugins and probably uses the enabled one with the highest Priority.

Constructors​

MemberWhat it is
protected AtmospherePlugin()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

MemberWhat it is
protected Color currentFogColorFog colour field for subclasses.
protected float currentFogDensityFog density field for subclasses.
protected AmbienceAudio mainSourceThe ambience audio source.
protected AtmosphereManager managerThe atmosphere manager that owns this plugin.
2 private and internal fields
MemberWhat it is
private int pluginHashBacking field for Hash, set by StartValues. The manager and atmosphere sets use it to find the plugin.
private int priorityBacking field for Priority; higher wins when several plugins are enabled. Default 5.

Properties​

MemberWhat it is
virtual float AmbienceVolume { get; set; }Volume of the ambience audio source. 0 and ignored when there is no audio.
abstract Color CurrentAmbience { get; }Ambient light colour this plugin wants now.
abstract Color CurrentFog { get; }Fog colour this plugin wants now.
abstract float CurrentFogDensity { get; }Fog density this plugin wants now.
bool HasAudio { get; private set; }True if there is an ambience source. Always false on a headless server, where the source is destroyed.
int Hash { get; }Identifier the manager gives this plugin in StartValues.
bool IsEnabled { get; private set; }True between Enable and Disable.
bool IsInitialized { get; protected set; }True once Initialize has run.
Color? OverrideAmbience { get; set; }Optional colour that replaces the ambient colour when set.
int Priority { get; }Higher priority plugins win over lower ones.

Methods​

MemberWhat it is
virtual void Disable()Turns the plugin off and asks the manager to drop it from the priority list.
void Enable()Turns the plugin on and hands its audio to the manager. If already on, calls Reenabled instead.
virtual void Initialize(AtmosphereManager manager)Stores the manager and sets up audio. On a headless server it destroys the audio source.
virtual void Mute(bool isMuted)Mutes or unmutes the ambience source.
virtual void OnConnect(Player player)Hook called for a connecting player. Does nothing by default.
virtual void StartAudio()Starts the ambience source if it is not already playing.
virtual void StartValues(AtmosphereManager manager, int hash)Stores the manager and the hash the manager assigned.
virtual void StopAudio()Stops the ambience source.
protected abstract void Enabled()Subclass hook called by Enable when the plugin turns on.
protected virtual void Reenabled()Called when Enable is called on an already enabled plugin.

Used in​

Members of other types that take, return or hold a AtmospherePlugin: