修复技能输入并更新战斗资源

This commit is contained in:
ud18010
2026-07-30 20:10:38 +08:00
parent d3c4bba5b2
commit 576aa6c14e
9077 changed files with 1322721 additions and 2648 deletions
@@ -70,6 +70,33 @@ public sealed class LobbyActorBehaviorRuntimeTests
Assert.That(runtime.DrainEvents().Any(e => e.BehaviorId == LobbyActorBehaviorRuntime.SecondaryABehaviorId), Is.False);
}
[Test]
public void Skill1Tap_DoesNotRestartWhileSkillIsActive()
{
var runtime = new LobbyActorBehaviorRuntime();
runtime.RegisterCatalog(CreateFighterCatalog());
runtime.RegisterOrUpdateActor(10, Vector3.zero, Vector3.forward);
BehaviorStartResult first = runtime.HandleActionButton(
CreateButtonEvent(ActionButtonId.Skill1, ActionButtonPhase.Tap, Vector2.zero),
10,
Vector3.forward);
runtime.DrainEvents();
BehaviorStartResult second = runtime.HandleActionButton(
CreateButtonEvent(ActionButtonId.Skill1, ActionButtonPhase.Tap, Vector2.zero),
10,
Vector3.forward);
BehaviorEvent[] events = runtime.DrainEvents().ToArray();
Assert.That(first.Success, Is.True);
Assert.That(second.Success, Is.False);
Assert.That(second.Error, Is.EqualTo("actor already has active behavior"));
Assert.That(events.Any(e => e.Kind == BehaviorEventKind.BehaviorStopped), Is.False);
Assert.That(events.Any(e => e.Kind == BehaviorEventKind.BehaviorStarted), Is.False);
Assert.That(events.Any(e => e.Kind == BehaviorEventKind.TimelineAnimation), Is.False);
}
private static ActionButtonEvent CreateButtonEvent(ActionButtonId buttonId, ActionButtonPhase phase, Vector2 direction)
{
return new ActionButtonEvent(buttonId, phase, Vector2.zero, Vector2.zero, direction, direction.magnitude, 0f, false, 1);