Commit Graph

4 Commits

Author SHA1 Message Date
hypercross 4182bc1578 feat(bt): support generator leaves and delta time
Introduce support for generator functions in leaf tasks, allowing
them to yield for multi-frame execution. The `TaskRunner` now accepts
a delta time (`dt`) parameter, which is passed through to leaf
handlers.

Additionally, a `Cancel` symbol is introduced to allow leaf tasks to
explicitly cancel their subtree via a thrown error.
2026-06-02 00:10:18 +08:00
hypercross efa92be5ab feat(bt): implement subtree status clearing in TaskRunner
Introduce `clearSubtree` to recursively reset status for an entity and
all its descendants. This ensures that when a task reaches a terminal
state, its entire branch is properly reset.

Also refactor the Tetris example to use a sequential task node within
the behavior tree.
2026-06-01 23:24:43 +08:00
hypercross 3620e80807 feat(bt): add repeat and selector task kinds 2026-06-01 22:57:14 +08:00
hypercross 4e37e03d3f feat: add behavior tree implementation
Introduces a `TaskRunner` for executing behavior trees within the
ECS world. Supports leaf, sequential, parallel, and random task
kinds, along with status propagation (succeeded, failed, cancelled).
2026-06-01 22:52:10 +08:00