fix: harden actor behavior authority logic
This commit is contained in:
@@ -32,6 +32,38 @@ namespace XWorld.Framework.Tests.ActorBehavior
|
||||
Assert.Contains(world.DrainEvents(), e =>
|
||||
e.Kind == BehaviorEventKind.AttributeEffectRequested && e.TargetActorId == 3);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("sector_test")]
|
||||
[InlineData("line_test")]
|
||||
public void DirectionalShapes_UseInputDirectionInsteadOfActorForward(string behaviorId)
|
||||
{
|
||||
BehaviorWorld world = TestTargetWorld.Create();
|
||||
|
||||
world.TryStartBehavior(1, behaviorId, BehaviorInput.FromDirection(0, 1));
|
||||
world.Tick(0.01f);
|
||||
var events = world.DrainEvents();
|
||||
|
||||
Assert.Contains(events, e =>
|
||||
e.Kind == BehaviorEventKind.AttributeEffectRequested && e.TargetActorId == 4);
|
||||
Assert.DoesNotContain(events, e =>
|
||||
e.Kind == BehaviorEventKind.AttributeEffectRequested && e.TargetActorId == 2);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DirectionalShapes_UseTargetPositionDirectionInsteadOfActorForward()
|
||||
{
|
||||
BehaviorWorld world = TestTargetWorld.Create();
|
||||
|
||||
world.TryStartBehavior(1, "sector_test", BehaviorInput.FromTargetPosition(0, 0, 2));
|
||||
world.Tick(0.01f);
|
||||
var events = world.DrainEvents();
|
||||
|
||||
Assert.Contains(events, e =>
|
||||
e.Kind == BehaviorEventKind.AttributeEffectRequested && e.TargetActorId == 4);
|
||||
Assert.DoesNotContain(events, e =>
|
||||
e.Kind == BehaviorEventKind.AttributeEffectRequested && e.TargetActorId == 2);
|
||||
}
|
||||
}
|
||||
|
||||
internal static class TestTargetWorld
|
||||
|
||||
Reference in New Issue
Block a user