diff --git a/Assets/Scripts/Runtime/CameraController.cs b/Assets/Scripts/Runtime/CameraController.cs index acde62b4..e2e0a8d3 100644 --- a/Assets/Scripts/Runtime/CameraController.cs +++ b/Assets/Scripts/Runtime/CameraController.cs @@ -12,6 +12,10 @@ namespace TKS public float MinViewHeight = 10f; public float MaxViewHeight = 36f; public float Margin = 1f; + [Tooltip("위쪽 HUD(스테이지·턴 글자) 밑에 유닛이 깔리지 않도록 전장 위 끝을 더 내려 볼 수 있는 여유")] + public float TopMargin = 2.6f; + [Tooltip("아래쪽 HUD(안내·유닛 정보) 여유")] + public float BottomMargin = 2.2f; public float FollowSpeed = 7f; Camera cam; @@ -127,8 +131,8 @@ namespace TKS var r = Board.Rect; float minX = r.xMin - Margin + halfW; float maxX = r.xMax + Margin - halfW; - float minY = r.yMin - Margin + halfH; - float maxY = r.yMax + Margin - halfH; + float minY = r.yMin - BottomMargin + halfH; + float maxY = r.yMax + TopMargin - halfH; p.x = minX > maxX ? 0f : Mathf.Clamp(p.x, minX, maxX); p.y = minY > maxY ? 0f : Mathf.Clamp(p.y, minY, maxY); return p; diff --git a/Assets/Tests/PlayMode/BattleFlowTests.cs b/Assets/Tests/PlayMode/BattleFlowTests.cs index 67485f90..c7aa52d8 100644 --- a/Assets/Tests/PlayMode/BattleFlowTests.cs +++ b/Assets/Tests/PlayMode/BattleFlowTests.cs @@ -243,7 +243,7 @@ namespace TKS.Tests var r = bm.Board.Rect; cc.SnapTo(new Vector2(1000f, 1000f)); var v = cc.ViewRect; - Assert.LessOrEqual(v.yMax, r.yMax + cc.Margin + 0.01f, "전장 위쪽 밖으로 못 나감"); + Assert.LessOrEqual(v.yMax, r.yMax + cc.TopMargin + 0.01f, "전장 위쪽 밖으로 못 나감(HUD 여유만큼만)"); Assert.LessOrEqual(v.xMax, r.xMax + cc.Margin + 0.01f + Mathf.Max(0f, v.width - r.width), "전장 오른쪽 밖으로 못 나감"); cc.SnapTo(Vector2.zero); cc.PanBy(new Vector2(0f, 2f));