Arcade
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
GameAPI.BudgetBoy.CoroutineContainer Class Referenceabstract

Base class for any types that hold a CoroutineCollection, providing some protected methods for convenience. More...

Inheritance diagram for GameAPI.BudgetBoy.CoroutineContainer:
GameAPI.BudgetBoy.Entity GameAPI.BudgetBoy.Stage

Protected Member Functions

 CoroutineContainer ()
 Base constructor for a CoroutineContainer with an empty CoroutineCollection. More...
 
abstract Stage GetStage ()
 Should return the Stage containing this instance, used to find things like the time step to use for Delay awaitables. More...
 
Awaitable Delay (double seconds)
 Creates a Delay Awaitable representing a pause of execution for the given duration. More...
 
Awaitable While (Func< bool > predicate)
 Creates a While Awaitable representing a pause of execution while the given predicate evaluates as true, where evaluation occurs each update. More...
 
Awaitable Until (Func< bool > predicate)
 Creates an Until Awaitable representing a pause of execution until the given predicate evaluates as true, where evaluation occurs each update. More...
 
Awaitable Sequential (params Awaitable[] inner)
 Creates a Sequential Awaitable representing a pause of execution until all elements of the given array of Awaitables have been executed in sequence. More...
 
Awaitable Parallel (params Awaitable[] inner)
 Creates a Parallel Awaitable representing a pause of execution until all elements of the given array of Awaitables have been executed concurrently. More...
 
Awaitable PlayAnimation (Animation anim)
 Creates a PlayAnimation Awaitable representing a pause of execution until the given Animation has completed. The animation will be advanced automatically. More...
 
Awaitable PlayAnimation (Animation anim, Awaitable @while)
 Creates a PlayAnimation Awaitable representing a pause of execution until either the given Animation or Awaitable has completed. The animation will be advanced automatically. Used for looping animations that would otherwise never terminate. More...
 
Awaitable WaitForAnimation (Animation anim)
 Creates a PlayAnimation Awaitable representing a pause of execution until the given Animation has completed. The animation will not be advanced automatically. More...
 
Awaitable WaitForAnimation (Animation anim, Awaitable @while)
 Creates a PlayAnimation Awaitable representing a pause of execution until either the given Animation or Awaitable has completed. The animation will not be advanced automatically. Used for looping animations that would otherwise never terminate. More...
 
Coroutine StartCoroutine (params Object[] awaitables)
 Starts a coroutine from a sequence of objects that can be converted to Awaitable instances. More...
 
Coroutine StartCoroutine (IEnumerator routine)
 Starts a coroutine from an IEnumerator that is expected to yeild Awaitable instances, null references (to delay until next the update), or other IEnumerator coroutines. When another IEnumerator is yielded the parent IEnumerator will pause execution until the child IEnumerator has finished. More...
 
Coroutine StartCoroutine (Func< IEnumerator > routine)
 Starts a coroutine from a function returning IEnumerator that is expected to yeild Awaitable instances, null references (to delay until next the update), or other IEnumerator coroutines. When another IEnumerator is yielded the parent IEnumerator will pause execution until the child IEnumerator has finished. More...
 
void UpdateCoroutines ()
 Causes all active Coroutine instances attached to this CoroutineContainer to execute one step. More...
 

Detailed Description

Base class for any types that hold a CoroutineCollection, providing some protected methods for convenience.

Constructor & Destructor Documentation

GameAPI.BudgetBoy.CoroutineContainer.CoroutineContainer ( )
inlineprotected

Base constructor for a CoroutineContainer with an empty CoroutineCollection.

Member Function Documentation

Awaitable GameAPI.BudgetBoy.CoroutineContainer.Delay ( double  seconds)
inlineprotected

Creates a Delay Awaitable representing a pause of execution for the given duration.

Parameters
secondsTime execution should be paused, in seconds.
Returns
A Delay Awaitable that may be yielded by a Coroutine.
abstract Stage GameAPI.BudgetBoy.CoroutineContainer.GetStage ( )
protectedpure virtual

Should return the Stage containing this instance, used to find things like the time step to use for Delay awaitables.

Returns
The Stage containing this instance.

Implemented in GameAPI.BudgetBoy.Stage, and GameAPI.BudgetBoy.Entity.

Awaitable GameAPI.BudgetBoy.CoroutineContainer.Parallel ( params Awaitable[]  inner)
inlineprotected

Creates a Parallel Awaitable representing a pause of execution until all elements of the given array of Awaitables have been executed concurrently.

Parameters
innerSet of Awaitables to be executed concurrently.
Returns
A Parallel Awaitable that may be yielded by a Coroutine.
Awaitable GameAPI.BudgetBoy.CoroutineContainer.PlayAnimation ( Animation  anim)
inlineprotected

Creates a PlayAnimation Awaitable representing a pause of execution until the given Animation has completed. The animation will be advanced automatically.

Parameters
animAnimation to play.
Returns
A PlayAnimation Awaitable that may be yielded by a Coroutine.
Awaitable GameAPI.BudgetBoy.CoroutineContainer.PlayAnimation ( Animation  anim,
Awaitable while 
)
inlineprotected

Creates a PlayAnimation Awaitable representing a pause of execution until either the given Animation or Awaitable has completed. The animation will be advanced automatically. Used for looping animations that would otherwise never terminate.

Parameters
animAnimation to play.
whileInner Awaitable to wait for before stopping the Animation.
Returns
A PlayAnimation Awaitable that may be yielded by a Coroutine.
Awaitable GameAPI.BudgetBoy.CoroutineContainer.Sequential ( params Awaitable[]  inner)
inlineprotected

Creates a Sequential Awaitable representing a pause of execution until all elements of the given array of Awaitables have been executed in sequence.

Parameters
innerSequence of Awaitables to be executed.
Returns
A Sequential Awaitable that may be yielded by a Coroutine.
Coroutine GameAPI.BudgetBoy.CoroutineContainer.StartCoroutine ( params Object[]  awaitables)
inlineprotected

Starts a coroutine from a sequence of objects that can be converted to Awaitable instances.

Parameters
awaitablesSequence of Awaitables representing actions to perform.
Returns
A Coroutine instance corresponding to the sequence of Awaitables.
Coroutine GameAPI.BudgetBoy.CoroutineContainer.StartCoroutine ( IEnumerator  routine)
inlineprotected

Starts a coroutine from an IEnumerator that is expected to yeild Awaitable instances, null references (to delay until next the update), or other IEnumerator coroutines. When another IEnumerator is yielded the parent IEnumerator will pause execution until the child IEnumerator has finished.

Parameters
routineIEnumerator representing a Coroutine.
Returns
A Coroutine instance corresponding to the enumerator.
Coroutine GameAPI.BudgetBoy.CoroutineContainer.StartCoroutine ( Func< IEnumerator >  routine)
inlineprotected

Starts a coroutine from a function returning IEnumerator that is expected to yeild Awaitable instances, null references (to delay until next the update), or other IEnumerator coroutines. When another IEnumerator is yielded the parent IEnumerator will pause execution until the child IEnumerator has finished.

Parameters
routineFunction representing a Coroutine.
Returns
A Coroutine instance corresponding to the function.
Awaitable GameAPI.BudgetBoy.CoroutineContainer.Until ( Func< bool >  predicate)
inlineprotected

Creates an Until Awaitable representing a pause of execution until the given predicate evaluates as true, where evaluation occurs each update.

Parameters
predicatePredicate to evaluate each update.
Returns
An Until Awaitable that may be yielded by a Coroutine.
void GameAPI.BudgetBoy.CoroutineContainer.UpdateCoroutines ( )
inlineprotected

Causes all active Coroutine instances attached to this CoroutineContainer to execute one step.

Awaitable GameAPI.BudgetBoy.CoroutineContainer.WaitForAnimation ( Animation  anim)
inlineprotected

Creates a PlayAnimation Awaitable representing a pause of execution until the given Animation has completed. The animation will not be advanced automatically.

Parameters
animAnimation to play.
Returns
A PlayAnimation Awaitable that may be yielded by a Coroutine.
Awaitable GameAPI.BudgetBoy.CoroutineContainer.WaitForAnimation ( Animation  anim,
Awaitable while 
)
inlineprotected

Creates a PlayAnimation Awaitable representing a pause of execution until either the given Animation or Awaitable has completed. The animation will not be advanced automatically. Used for looping animations that would otherwise never terminate.

Parameters
animAnimation to play.
whileInner Awaitable to wait for before stopping the Animation.
Returns
A PlayAnimation Awaitable that may be yielded by a Coroutine.
Awaitable GameAPI.BudgetBoy.CoroutineContainer.While ( Func< bool >  predicate)
inlineprotected

Creates a While Awaitable representing a pause of execution while the given predicate evaluates as true, where evaluation occurs each update.

Parameters
predicatePredicate to evaluate each update.
Returns
A While Awaitable that may be yielded by a Coroutine.