ezEngine  Release 25.03
ezScriptCoroutine Class Referenceabstract

Base class of script coroutines. More...

#include <ScriptCoroutine.h>

Inheritance diagram for ezScriptCoroutine:

Classes

struct  Result
 

Public Member Functions

ezScriptCoroutineHandle GetHandle ()
 
ezStringView GetName () const
 
ezScriptInstanceGetScriptInstance ()
 
const ezScriptInstanceGetScriptInstance () const
 
ezScriptWorldModuleGetScriptWorldModule ()
 
const ezScriptWorldModuleGetScriptWorldModule () 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
 

Detailed Description

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.


The documentation for this class was generated from the following files: