ScriptSystemExtensions.

AddOnEventTask<T>(ScriptSystem, EventKey<T>, Func<T, Task>, long) Method

Summary

Adds a micro thread function to the scriptSystem that executes when the event is published.
Namespace
StrideToolkit.Engine
Containing Type
ScriptSystemExtensions

Syntax

public static MicroThread AddOnEventTask<T>(this ScriptSystem scriptSystem, EventKey<T> eventKey, Func<T, Task> action, long priority = 0)

Remarks

If the action is a ScriptComponent instance method the micro thread will be automatically stopped if the ScriptComponent or Entity is removed.

Type Parameters

Name Description
T The type of the event handler parameter.

Parameters

Name Type Description
scriptSystem ScriptSystem The ScriptSystem.
eventKey EventKey<T> The event to wait for.
action Func<T, Task> The micro thread function to execute.
priority long The priority of the micro thread action being added.

Return Value

Type Description
MicroThread The MicroThread.