修复技能输入并更新战斗资源
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user