fix(huoshan): 修复发条终点判定与越界拖拽

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-13 22:55:12 +08:00
co-authored by Cursor
parent 0ed1253a40
commit 431401c52f
@@ -138,12 +138,17 @@ namespace AibisDream.MiniGame.HuoShan
crankTransform = transform;
}
// 确保触发角度不超过最大旋转角度
maxRotationAngle = Mathf.Max(0.01f, maxRotationAngle);
dragResistance = Mathf.Clamp01(dragResistance);
// 完成判定不能超过画面上的旋转终点。
// 旧逻辑会在配置越界时悄悄改为 80%,导致画面、手感和判定使用不同的角度。
if (triggerAngle > maxRotationAngle)
{
Debug.LogWarning($"[CrankController] triggerAngle ({triggerAngle}°) 超过 maxRotationAngle ({maxRotationAngle}°),已自动调整为 {maxRotationAngle * 0.8f:F0}°", this);
triggerAngle = maxRotationAngle * 0.8f;
Debug.LogWarning($"[CrankController] triggerAngle ({triggerAngle}°) 超过 maxRotationAngle ({maxRotationAngle}°),已对齐到旋转终点", this);
triggerAngle = maxRotationAngle;
}
triggerAngle = Mathf.Clamp(triggerAngle, 0f, maxRotationAngle);
// 未配置交互碰撞体时,尝试从 crankTransform 获取
if (interactionCollider == null && crankTransform != null)
@@ -474,9 +479,9 @@ namespace AibisDream.MiniGame.HuoShan
float targetRotation = _currentRotation + frameDelta * (1f - dragResistance);
// 仅当目标在范围内时更新,超出范围则保持当前位置不跟过去
if (targetRotation >= 0f && targetRotation <= maxRotationAngle)
_currentRotation = targetRotation;
// 拖拽一帧跨过起点/终点时直接夹到边界。
// 若拒绝越界的整帧移动,当触发角度等于最大角度时就可能永远到不了终点。
_currentRotation = Mathf.Clamp(targetRotation, 0f, maxRotationAngle);
ApplyCrankTransform(_currentRotation);
@@ -516,7 +521,8 @@ namespace AibisDream.MiniGame.HuoShan
},
maxRotationAngle,
Mathf.Max(0.01f, completionSnapDuration))
.SetEase(Ease.OutBack)
// OutBack 会超过 maxRotationAngle,导致实际画面角度大于配置上限。
.SetEase(Ease.OutCubic)
.OnComplete(() =>
{
_completeTween = null;