![]() |
vkmEngine 1.0.0
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 | endSession (Scene &scene) |
| End the session: onDestroy on every started behavior, reset, and discard queued requests. | |
Static Public Member Functions | |
| static void | destroyEntityBehaviors (Scene &scene, EntityId entity) |
Fire onDestroy on entity's started behaviors, before its ScriptComponent goes. | |
Drives the lifecycle of every entity's ScriptComponent behaviors.
Runs before PhysicsSystem in Simulation, so physics integrates script state the same frame. 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.
| 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. |
Fire onDestroy on entity's started behaviors, before its ScriptComponent goes.
| scene | Scene holding the entity. |
| entity | Entity whose behaviors are told. |