Class TemperatureEmitter
- Namespace
- S1API.Temperature
- Assembly
- S1API.dll
Wraps a native temperature emitter attached to a mod-owned game object.
public sealed class TemperatureEmitter
- Inheritance
-
TemperatureEmitter
- Inherited Members
- Extension Methods
Remarks
Adding this component does not register it with a native grid, persist its configuration, or synchronize it over the network.
Fields
DefaultAmbientTemperature
Gets the default ambient temperature, in degrees Celsius.
public const float DefaultAmbientTemperature = 20
Field Value
DefaultRange
Gets the default emitter range, in world units.
public const float DefaultRange = 5
Field Value
MaxRange
Gets the maximum emitter range, in world units.
public const float MaxRange = 100
Field Value
MaxTemperature
Gets the maximum emitter temperature, in degrees Celsius.
public const float MaxTemperature = 40
Field Value
MinRange
Gets the minimum emitter range, in world units.
public const float MinRange = 0.1
Field Value
MinTemperature
Gets the minimum emitter temperature, in degrees Celsius.
public const float MinTemperature = 0
Field Value
Properties
EmissionPoint
Gets the emitter position in world space.
public Vector3 EmissionPoint { get; }
Property Value
- Vector3
Range
Gets the emitter range in world units.
public float Range { get; }
Property Value
Temperature
Gets the emitter temperature in degrees Celsius.
public float Temperature { get; }
Property Value
Methods
FromGameObject(GameObject)
Gets the native temperature emitter attached to a game object.
public static TemperatureEmitter? FromGameObject(GameObject gameObject)
Parameters
gameObjectGameObjectThe game object to inspect.
Returns
- TemperatureEmitter
A temperature-emitter wrapper, or
nullwhen the game object has no emitter component.
Exceptions
- ArgumentNullException
gameObjectisnullor destroyed.
GetOrAddComponent(GameObject)
Gets the first native temperature emitter on a game object, or adds one when none exists.
public static TemperatureEmitter GetOrAddComponent(GameObject gameObject)
Parameters
gameObjectGameObjectThe game object that owns the emitter component.
Returns
- TemperatureEmitter
A wrapper around the existing or newly added emitter.
Remarks
When a game object has multiple native emitter components, this method returns the first component selected by Unity.
Exceptions
- ArgumentNullException
gameObjectisnullor destroyed.
NotifyChanged()
Informs native listeners that the emitter changed.
public void NotifyChanged()
SetPosition(Vector3)
Updates the emitter position in world space.
public void SetPosition(Vector3 position)
Parameters
positionVector3The new emitter position in world space. Every component must be finite.
Exceptions
- ArgumentOutOfRangeException
A position component is not finite.
SetRange(float)
Updates the emitter range in world units.
public void SetRange(float range)
Parameters
Exceptions
- ArgumentOutOfRangeException
rangeis not finite.
SetTemperature(float)
Updates the emitter temperature.
public void SetTemperature(float temperature)
Parameters
temperaturefloatThe new temperature in degrees Celsius. Finite values are clamped to MinTemperature through MaxTemperature.
Exceptions
- ArgumentOutOfRangeException
temperatureis not finite.
ToInfo()
Creates an immutable managed snapshot of the emitter's current values.
public TemperatureEmitterInfo ToInfo()
Returns
- TemperatureEmitterInfo
A snapshot suitable for GetTemperatureAtPoint(float, Vector3, Vector3, TemperatureEmitterInfo[]).
Events
OnChanged
Occurs when the native emitter reports a change.
public event Action OnChanged