Table of Contents

Class Coroutine

Namespace
Cobilas.GodotEngine.Utility
Assembly
com.cobilas.godot.utility.dll

This class represents a corrotine process.

public sealed class Coroutine : IEnumerable, IDisposable
Inheritance
Coroutine
Implements
Inherited Members

Constructors

Coroutine(IEnumerator?, string?)

Creates a new instance of this object.

public Coroutine(IEnumerator? enumerator, string? iD)

Parameters

enumerator IEnumerator

The IEnumerator object that will be used.

iD string

The ID of this Coroutine object.

Exceptions

ArgumentNullException

It occurs when the enumerator parameter is null.

ArgumentNullException

It occurs when the ID parameter is null.

Properties

ID

The process id.

public string ID { get; }

Property Value

string

Returns a string with process ID.

IsCancellationRequested

Gets whether cancellation has been requested for this CancellationTokenSource.

public bool IsCancellationRequested { get; }

Property Value

bool

true if cancellation has been requested for this CancellationTokenSource; otherwise, false.

IsRunning

Indicates if the process is running.

public bool IsRunning { get; }

Property Value

bool

Returns true if the process is ongoing.

Returns false when the process is completed.

Methods

Cancel()

Emits the cancellation signal for the Coroutine process.

public void Cancel()

Exceptions

ObjectDisposedException

This CancellationTokenSource has been disposed.

AggregateException

An aggregate exception containing all the exceptions thrown by the registered callbacks on the associated CancellationToken.

CancelAfter(int)

Emits a delayed cancellation signal for the Coroutine process.

public void CancelAfter(int millisecondsDelay)

Parameters

millisecondsDelay int

Defines the delay in milliseconds where the cancellation signal will be issued.

Exceptions

ObjectDisposedException

The exception thrown when this CancellationTokenSource has been disposed.

ArgumentOutOfRangeException

The exception that is thrown when delay is less than -1 or greater than Int32.MaxValue.

CancelAfter(TimeSpan)

Emits a delayed cancellation signal for the Coroutine process.

public void CancelAfter(TimeSpan delay)

Parameters

delay TimeSpan

Defines the delay where the cancellation signal will be issued.

Exceptions

ObjectDisposedException

The exception thrown when this CancellationTokenSource has been disposed.

ArgumentOutOfRangeException

The exception that is thrown when delay is less than -1 or greater than Int32.MaxValue.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

~Coroutine()

The destructor is responsible for discarding unmanaged resources.

protected ~Coroutine()

GenID()

Generates an ID to be used in a Coroutine.

public static string GenID()

Returns

string

Returns in string form the ID generated.

StartCoroutine(IEnumerator?)

Starts a collating process from an IEnumerator.

public static Coroutine StartCoroutine(IEnumerator? enumerator)

Parameters

enumerator IEnumerator

The IEnumerator that will be used to start the Coroutine.

Returns

Coroutine

Returns the Coroutine process that was started.

Exceptions

ArgumentNullException

When the object is null.

StopAllCoroutines()

Ends all open Coroutines.

public static void StopAllCoroutines()

StopCoroutine(Coroutine?)

Ends all open Coroutines.

public static void StopCoroutine(Coroutine? Coroutine)

Parameters

Coroutine Coroutine

The Coroutine that will be closed.