Table of Contents

Class GravitasCoroutineService

Namespace
Gravitas.Support
Assembly
Gravitas.dll

Owns lockstep coroutine state for one GravitasWorldContext.

public sealed class GravitasCoroutineService
Inheritance
GravitasCoroutineService
Inherited Members

Constructors

GravitasCoroutineService(GravitasWorldContext)

Initializes a new coroutine service for the supplied context.

public GravitasCoroutineService(GravitasWorldContext context)

Parameters

context GravitasWorldContext

The owning world context.

Properties

ActiveCoroutineCount

Gets the number of active coroutines owned by this context.

public int ActiveCoroutineCount { get; }

Property Value

int

Context

Gets the owning world context.

public GravitasWorldContext Context { get; }

Property Value

GravitasWorldContext

Methods

Deactivate()

Deactivates this coroutine service, disposes all active coroutine state, and rejects new work.

public void Deactivate()

Remarks

A manually deactivated service can be reactivated by Initialize() while its context remains active.

Initialize()

Clears context-local coroutine state and reactivates a manually deactivated service.

public void Initialize()

Exceptions

InvalidOperationException

The service is already resetting or its context has been disposed.

Reset()

Stops all active coroutines and clears service state.

public void Reset()

Simulate()

Advances active coroutines once for the current simulation frame.

public void Simulate()

StartCoroutine(IEnumerator<ILockedYieldInstruction>)

Starts a context-local coroutine.

public LSCoroutine StartCoroutine(IEnumerator<ILockedYieldInstruction> enumerator)

Parameters

enumerator IEnumerator<ILockedYieldInstruction>

The lockstep yield instruction enumerator to run.

Returns

LSCoroutine

The started coroutine handle.

Exceptions

ArgumentNullException

enumerator is null.

InvalidOperationException

The service is resetting or deactivated, or its context has been disposed.

StopCoroutine(LSCoroutine)

Stops a context-local coroutine.

public void StopCoroutine(LSCoroutine coroutine)

Parameters

coroutine LSCoroutine

The coroutine to stop.

WaitForFrames(int)

Creates a frame-count wait instruction bound to this service's context.

public WaitForFrames WaitForFrames(int frames)

Parameters

frames int

Returns

WaitForFrames

WaitForNextSimulate()

Creates a next-simulation-frame wait instruction bound to this service's context.

public WaitForNextSimulate WaitForNextSimulate()

Returns

WaitForNextSimulate

WaitForRealSeconds(Fixed64)

Creates a fixed-duration wait instruction bound to this service's context.

public WaitForRealSeconds WaitForRealSeconds(Fixed64 seconds)

Parameters

seconds Fixed64

Returns

WaitForRealSeconds