XII Release 0.1.0
Loading...
Searching...
No Matches
xiiScriptCoroutine Class Referenceabstract

#include <ScriptCoroutine.h>

Inheritance diagram for xiiScriptCoroutine:
[legend]

Classes

struct  Result

Public Member Functions

xiiScriptCoroutineHandle GetHandle ()
xiiStringView GetName () const
xiiScriptInstance * GetScriptInstance ()
const xiiScriptInstance * GetScriptInstance () const
xiiScriptWorldModule * GetScriptWorldModule ()
const xiiScriptWorldModule * GetScriptWorldModule () const
virtual void StartWithVarArgs (xiiArrayPtr< xiiVariant > arguments)=0
virtual void Stop ()
virtual Result Update (xiiTime deltaTimeSinceLastUpdate)=0
void UpdateAndSchedule (xiiTime deltaTimeSinceLastUpdate=xiiTime::MakeZero())

Friends

class xiiScriptWorldModule

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 xiiScriptWorldModule is used to create and manage coroutine objects. The coroutine can then either be started and scheduled automatically by calling xiiScriptWorldModule::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:
  • /home/runner/work/XII/XII/Source/Engine/Core/Scripting/ScriptCoroutine.h
  • /home/runner/work/XII/XII/Source/Engine/Core/Scripting/Implementation/ScriptCoroutine.cpp