Table of Contents

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

float

DefaultRange

Gets the default emitter range, in world units.

public const float DefaultRange = 5

Field Value

float

MaxRange

Gets the maximum emitter range, in world units.

public const float MaxRange = 100

Field Value

float

MaxTemperature

Gets the maximum emitter temperature, in degrees Celsius.

public const float MaxTemperature = 40

Field Value

float

MinRange

Gets the minimum emitter range, in world units.

public const float MinRange = 0.1

Field Value

float

MinTemperature

Gets the minimum emitter temperature, in degrees Celsius.

public const float MinTemperature = 0

Field Value

float

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

float

Temperature

Gets the emitter temperature in degrees Celsius.

public float Temperature { get; }

Property Value

float

Methods

FromGameObject(GameObject)

Gets the native temperature emitter attached to a game object.

public static TemperatureEmitter? FromGameObject(GameObject gameObject)

Parameters

gameObject GameObject

The game object to inspect.

Returns

TemperatureEmitter

A temperature-emitter wrapper, or null when the game object has no emitter component.

Exceptions

ArgumentNullException

gameObject is null or 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

gameObject GameObject

The 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

gameObject is null or 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

position Vector3

The 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

range float

The new range in world units. Finite values are clamped to MinRange through MaxRange.

Exceptions

ArgumentOutOfRangeException

range is not finite.

SetTemperature(float)

Updates the emitter temperature.

public void SetTemperature(float temperature)

Parameters

temperature float

The new temperature in degrees Celsius. Finite values are clamped to MinTemperature through MaxTemperature.

Exceptions

ArgumentOutOfRangeException

temperature is 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

Event Type

Action