Plasma Engine  2.0
Loading...
Searching...
No Matches
plScriptCoroutine Class Referenceabstract

Base class of script coroutines. More...

#include <ScriptCoroutine.h>

Inheritance diagram for plScriptCoroutine:

Classes

struct  Result
 

Public Member Functions

plScriptCoroutineHandle GetHandle ()
 
plStringView GetName () const
 
plScriptInstanceGetScriptInstance ()
 
const plScriptInstanceGetScriptInstance () const
 
plScriptWorldModuleGetScriptWorldModule ()
 
const plScriptWorldModuleGetScriptWorldModule () const
 
virtual void StartWithVarargs (plArrayPtr< plVariant > arguments)=0
 
virtual void Stop ()
 
virtual Result Update (plTime deltaTimeSinceLastUpdate)=0
 
void UpdateAndSchedule (plTime deltaTimeSinceLastUpdate=plTime::MakeZero())
 

Friends

class plScriptWorldModule
 

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 plScriptWorldModule is used to create and manage coroutine objects. The coroutine can then either be started and scheduled automatically by calling plScriptWorldModule::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: