![]() |
vkmEngine 1.0.15
A C++ game engine · vkmengine.com
|
Drives the lifecycle of every entity's ScriptComponent behaviors. More...
#include <behavior_system.h>
Public Member Functions | |
| void | init (FrameContext &ctx) override |
| Called once after all systems are registered, before the first update. | |
| void | update (FrameContext &ctx) override |
| Execute this system for the current frame. | |
| void | fixedUpdate (FrameContext &ctx) override |
| Execute this system at the fixed simulation rate. | |
| bool | isReplayed () const override |
| Re-run during a replay: it moves the world from state and command, repeatably. | |
| void | shutdown () override |
| Called once on engine shutdown. | |
| void | onEntityDestroyed (EntityId entity) override |
ISceneObserver: fire onDestroy on entity's behaviors before its ScriptComponent goes. | |
| void | setPlayedScene (std::string path) |
| The file a host began play with, which a restart reloads while no loadScene has replaced it: a runtime's or a server's entry scene. | |
| void | setRestartHandler (std::function< void()> restart) |
Hand a restart of the host's own scene to restart, which puts it back itself. | |
| void | endSession (Scene &scene) |
| End the session: onDestroy on every started behavior, reset, and discard queued requests. | |
Drives the lifecycle of every entity's ScriptComponent behaviors.
Runs before PhysicsSystem in Simulation: physics integrates what onFixedUpdate writes the same tick, and what onUpdate writes on the next frame's ticks. Destroy requests drain after each fixed tick and the frame pass; loadScene() after the frame pass only. Contacts are dispatched after onStart and before the destroy drain, so a handler may destroy its own entity. A throwing hook is reported through reportError() and the behavior disabled.
|
overridevirtual |
Called once after all systems are registered, before the first update.
| ctx | The first frame's context; its products are all null. |
Reimplemented from Vkm::Engine::System.
|
overridevirtual |
Execute this system for the current frame.
| ctx | This frame's services and the products published so far. |
Reimplemented from Vkm::Engine::System.
|
overridevirtual |
Execute this system at the fixed simulation rate.
Called 0+ times per frame; the step is ctx.clock.getFixedStep().
Runs before any producer stage, so ctx.visibility and ctx.ui are null here. ctx.poses is set by SkeletalAnimationSystem's own fixedUpdate, so a later Simulation system reads this tick's pose.
| ctx | This frame's services; see above for which products are set. |
Reimplemented from Vkm::Engine::System.
|
inlineoverridevirtual |
Re-run during a replay: it moves the world from state and command, repeatably.
Reimplemented from Vkm::Engine::System.
|
overridevirtual |
ISceneObserver: fire onDestroy on entity's behaviors before its ScriptComponent goes.
Runs inside Scene::destroyEntity, whatever called it.
| entity | The entity being destroyed. |
Implements Vkm::Engine::ISceneObserver.
|
inline |
The file a host began play with, which a restart reloads while no loadScene has replaced it: a runtime's or a server's entry scene.
| path | Scene file, absolute or relative to the project root. |
|
inline |
Hand a restart of the host's own scene to restart, which puts it back itself.
For a host whose scene is held in memory rather than a file: the editor's, the scene as Play found it. Called inside the frame; the host acts where it can replace the world.
| restart | Asked to start play over; null hands restarts back to setPlayedScene. |
| void Vkm::Engine::BehaviorSystem::endSession | ( | Scene & | scene | ) |
End the session: onDestroy on every started behavior, reset, and discard queued requests.
Drops subscriptions and the started/disabled flags. Call while the module is loaded and the EventBus alive. Queued destroy() / loadScene() requests named the world being torn down, so they go too.
| scene | Scene whose session ends. |