|
Nebula
|
A queue of actions that an runs one after the other.
The queue should be executed once per frame. An action that names a property runs for as long as that property is running (until ShouldDeactivate returns true).
A queue does not survive a hot reload. The reload walks the plugin's object graph, and the queue is an engine object held by the entity, so nothing walks it, and the unload detaches every property from every entity before the reattach, which empties the queue. An action that was running is gone after the reload, and the property comes back on its entity as an ordinary property.
Classes | |
| struct | Action |
| One entry of the queue. More... | |
Public Types | |
| enum | ActionType { None , Idle , Event , Duration , Property , Loop } |
Public Member Functions | |
| delegate void | EventCallback (float delta) |
| delegate bool | LoopCallback (float delta) |
| ActionQueue (int capacity=DefaultCapacity) | |
| bool | IsEmpty () |
| The actions that are still waiting. | |
| void | Idle (Entity owner, float seconds) |
| Does nothing for seconds. | |
| void | Event (Entity owner, EventCallback callback) |
| Runs the callback once. | |
| void | Duration (float seconds, Entity owner, EventCallback callback) |
| Runs the callback every frame for seconds. | |
| void | Property (Entity owner, ActionProperty property) |
| Runs a property for as long as it is running. | |
| void | Loop (Entity owner, LoopCallback callback) |
| Runs the callback every frame until it answers false. | |
| void | BeginExecution () |
| Loads the first action when nothing is running. | |
| void | Execute (float delta) |
| Advances one step of the queue. | |
| void | Clear () |
| Takes everything out of the queue, including the action that is running. | |
Properties | |
| ActionType | CurrentType [get] |
| The type of the action that is running, or None when nothing is. | |
| ActionProperty | CurrentProperty [get] |
| The property the action that is running names, or null when it is not a property action. | |
Private Member Functions | |
| void | Enqueue (Action action) |
| bool | TryDequeue (out Action action) |
Private Attributes | |
| readonly List< Action > | actions |
| int | head |
| Action | current |
| bool | hasCurrent |
Static Private Attributes | |
| const int | DefaultCapacity = 16 |
|
inline |
|
inline |
Loads the first action when nothing is running.
Call this after adding an action to a queue that was empty, or the queue does not start until the next Execute.
|
inline |
Takes everything out of the queue, including the action that is running.
|
inline |
Runs the callback every frame for seconds.
|
inlineprivate |
|
inline |
Runs the callback once.
| delegate void Nebula.Game.ActionQueue.EventCallback | ( | float | delta | ) |
|
inline |
Advances one step of the queue.
|
inline |
Does nothing for seconds.
|
inline |
The actions that are still waiting.
The action that is running is not one of them.
|
inline |
Runs the callback every frame until it answers false.
| delegate bool Nebula.Game.ActionQueue.LoopCallback | ( | float | delta | ) |
|
inline |
Runs a property for as long as it is running.
The property is only active while it is the front of this queue, which is what an ActionProperty's ShouldActivate answers with.
|
inlineprivate |
|
private |
|
staticprivate |
|
private |
|
private |
|
get |
The property the action that is running names, or null when it is not a property action.
|
get |
The type of the action that is running, or None when nothing is.