Skip to content

MockStream

ClassMockMagiccom.wetzold.mock-magic
public class MockStream : MonoBehaviour

Continuous mock data streaming to registered listeners. Works in both Play Mode (via coroutines) and Edit Mode (via editor updates).

public void Register(Action<MockDataPoint[]> listener)

Register a listener to receive data emissions.

Parameters

NameType
listenerSystem.Action{MockMagic.MockDataPoint[]}
public void Unregister(Action<MockDataPoint[]> listener)

Unregister a listener.

Parameters

NameType
listenerSystem.Action{MockMagic.MockDataPoint[]}
public void ClearListeners()

Clear all registered listeners.

public void StartStream()

Start the data stream.

public void StopStream()

Stop the data stream.

public void Toggle()

Toggle the stream on/off.

public void EmitOnce()

Emit data once manually.

public MockStream()

public static MockStream Instance { get; }

Gets or creates the shared stream used by MockStreaming and the Generator. It lives on its own hidden GameObject; MockStream components in your scenes are never adopted, so they stream independently.

Returns

MockMagic.MockStream

public SeriesPattern Pattern { get; set; }

The pattern to use for generating series data.

Returns

MockMagic.SeriesPattern

public StreamRhythm Rhythm { get; set; }

The rhythm mode for emitting data.

Returns

MockMagic.StreamRhythm

public ClockMode ClockMode { get; set; }

Clock source used for automatic stream emissions.

Returns

ImpossibleRobert.Common.Timing.ClockMode

public float Interval { get; set; }

Base interval between emissions in seconds; the average gap for StreamRhythm.Drip.

Returns

System.Single

public float MinInterval { get; set; }

Minimum interval for random rhythm.

Returns

System.Single

public float MaxInterval { get; set; }

Maximum interval for random rhythm.

Returns

System.Single

public int PointsPerEmission { get; set; }

Number of points to generate per emission. StreamRhythm.Drip always emits one.

Returns

System.Int32

public int CycleLength { get; set; }

Number of points in one cycle of MockStream.Pattern; emissions continue the pattern where the previous one ended.

Returns

System.Int32

public int BurstCount { get; set; }

Number of emissions per burst (for Burst rhythm).

Returns

System.Int32

public float BurstDelay { get; set; }

Delay between bursts.

Returns

System.Single

public float MinValue { get; set; }

Minimum value for generated data.

Returns

System.Single

public float MaxValue { get; set; }

Maximum value for generated data.

Returns

System.Single

public float Noise { get; set; }

Noise factor for generated data.

Returns

System.Single

public LabelPreset LabelPreset { get; set; }

Label preset for generated data.

Returns

MockMagic.LabelPreset

public string[] CustomLabels { get; set; }

Labels cycled when MockStream.LabelPreset is LabelPreset.Custom.

Returns

System.String[]

public string DataLocaleId { get; set; }

Configured label locale. Changes take effect on the next start, or the next stopped manual emission.

Returns

System.String

public MockLocale ActiveLocale { get; }

Immutable locale captured by the active run, or null while stopped.

Returns

MockMagic.MockLocale

public string ActiveLocaleId { get; }

Locale identifier captured by the active run, or null while stopped.

Returns

System.String

public bool IsRunning { get; }

Whether the stream is currently running.

Returns

System.Boolean

public int ListenerCount { get; }

Gets the count of registered listeners.

Returns

System.Int32

public event Action<MockDataPoint[]> OnDataEmitted

Event fired when new data points are generated.

Returns

System.Action{MockMagic.MockDataPoint[]}

public event Action OnStreamStarted

Event fired when the stream starts.

Returns

System.Action

public event Action OnStreamStopped

Event fired when the stream stops.

Returns

System.Action