convert game playing..
This commit is contained in:
@@ -263,6 +263,25 @@ namespace BumpCombat.Tests
|
||||
?.SetValue(target, value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SetZoneBounds_UpdatesClampCenterAndExtents()
|
||||
{
|
||||
GameObject root = CreateBounds();
|
||||
ArenaBounds bounds = root.GetComponent<ArenaBounds>();
|
||||
|
||||
Vector2 newCenter = new Vector2(40f, 30f);
|
||||
bounds.SetZoneBounds(newCenter);
|
||||
|
||||
Vector2 clamped = bounds.ClampPlayerPosition(new Vector2(99f, 99f));
|
||||
Assert.That(clamped.x, Is.EqualTo(newCenter.x + 14.5f).Within(0.0001f));
|
||||
Assert.That(clamped.y, Is.EqualTo(newCenter.y + 7.8125f).Within(0.0001f));
|
||||
|
||||
bounds.ResetToDefaultBounds();
|
||||
Vector2 resetClamped = bounds.ClampPlayerPosition(new Vector2(99f, 99f));
|
||||
Assert.That(resetClamped.x, Is.EqualTo(14.5f).Within(0.0001f));
|
||||
Assert.That(resetClamped.y, Is.EqualTo(7.8125f).Within(0.0001f));
|
||||
}
|
||||
|
||||
private static GameObject CreateBounds()
|
||||
{
|
||||
GameObject root = new("Arena Bounds Test");
|
||||
|
||||
Reference in New Issue
Block a user