another approach for making the debugger nicer
This commit is contained in:
parent
b5d5a8f9f3
commit
b37c78d75b
4 changed files with 65 additions and 55 deletions
|
|
@ -52,27 +52,28 @@ public sealed partial class Birb : CharacterBody2D, IAttackable,
|
|||
{
|
||||
if (EngineDebugger.IsActive())
|
||||
EngineDebugger.SendMessage("behavior_debug:add_tree",
|
||||
new() { GetInstanceId(), Tree.DebugData });
|
||||
new() { Name, GetInstanceId(), Tree.DebugData });
|
||||
}
|
||||
|
||||
private Bt.Tree CreateTree() => new(
|
||||
new Bt.Selector([
|
||||
new Bt.Check(() => _state is State.Attacking) { Name = "Is state Attacking?" },
|
||||
new Bt.Sequence([
|
||||
new Bt.Check(() => Target is not null) { Name = "Has target?" },
|
||||
new Bt.Action(() => FaceToward(Target!.GlobalPosition)),
|
||||
new Bt.Action(() => FaceToward(Target!.GlobalPosition)) { Name = "Face target" },
|
||||
new Bt.Selector([
|
||||
new Bt.MemoSequence([
|
||||
new Bt.Sequence([
|
||||
new Bt.Check(() => StabHitbox.GetOverlappingBodies().Contains(Target)),
|
||||
new Bt.Check(() => StabHitbox.GetOverlappingBodies().Contains(Target))
|
||||
{ Name = "Target in stab hitbox?" },
|
||||
new Bt.MemoSequence([
|
||||
new Bt.Action(Stop) { Name = "Stop" },
|
||||
new Bt.Action(Stop) { Name = "Stop" },
|
||||
new Bt.PlayAnimation("prepare_attack"),
|
||||
new Bt.Delay(0.4) { RandomVariation = 0.2 },
|
||||
]),
|
||||
]),
|
||||
new Bt.PlayAnimation("stab"),
|
||||
new Bt.Action(() => _state = State.Attacking),
|
||||
new Bt.WaitUntil(() => _state is not State.Attacking) { Name = "Done attacking?" },
|
||||
new Bt.Action(() => _state = State.Attacking) { Name = "Set state to Attacking" },
|
||||
]),
|
||||
new Bt.MemoSequence([
|
||||
new Bt.Delay(0.1) { RandomVariation = 0.05 },
|
||||
|
|
@ -94,7 +95,6 @@ public sealed partial class Birb : CharacterBody2D, IAttackable,
|
|||
]),
|
||||
]),
|
||||
new Bt.MemoSequence([
|
||||
new Bt.Check(() => _state is State.Idle),
|
||||
new Bt.PlayAnimation("idle"),
|
||||
new Bt.DoNothing(),
|
||||
]),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue