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
IEnumeratorThe IEnumerator object that will be used.
iD
stringThe 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
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
intDefines 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
TimeSpanDefines 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()