![]() |
ezEngine
Release 25.03
|
Base class of script coroutines. More...
#include <ScriptCoroutine.h>
Classes | |
struct | Result |
Public Member Functions | |
ezScriptCoroutineHandle | GetHandle () |
ezStringView | GetName () const |
ezScriptInstance * | GetScriptInstance () |
const ezScriptInstance * | GetScriptInstance () const |
ezScriptWorldModule * | GetScriptWorldModule () |
const ezScriptWorldModule * | GetScriptWorldModule () const |
virtual void | StartWithVarargs (ezArrayPtr< ezVariant > arguments)=0 |
virtual void | Stop () |
virtual Result | Update (ezTime deltaTimeSinceLastUpdate)=0 |
void | UpdateAndSchedule (ezTime deltaTimeSinceLastUpdate=ezTime::MakeZero()) |
Friends | |
class | ezScriptWorldModule |
Base class of script coroutines.
A coroutine is a function that can be distributed over multiple frames and behaves similar to a mini state machine. That is why coroutines are actually individual objects that keep track of their state rather than simple functions. At first Start() is called with the arguments of the coroutine followed by one or multiple calls to Update(). The return value of the Update() function determines whether the Update() function should be called again next frame or at latest after the specified delay. If the Update() function returns completed the Stop() function is called and the coroutine object is destroyed. The ezScriptWorldModule is used to create and manage coroutine objects. The coroutine can then either be started and scheduled automatically by calling ezScriptWorldModule::StartCoroutine or the Start/Stop/Update function is called manually if the coroutine is embedded as a subroutine in another coroutine.