mirror of
http://47.107.252.169:3000/Roguelite-Game-Developing-Team/Gen_Hack-and-Slash-Roguelite.git
synced 2025-11-20 12:37:12 +08:00
(client) feat:添加基地界面到游玩界面的过程,添加存档管理,技能树变得可用 (#58)
Co-authored-by: m0_75251201 <m0_75251201@noreply.gitcode.com> Reviewed-on: http://47.107.252.169:3000/Roguelite-Game-Developing-Team/Gen_Hack-and-Slash-Roguelite/pulls/58
This commit is contained in:
@@ -6,16 +6,17 @@ namespace Utils
|
||||
{
|
||||
// 旋转对象到指定方向
|
||||
|
||||
public static void RotateTransformToDirection(Transform transform, Vector3 targetDirection)
|
||||
public static float RotateTransformToDirection(Transform transform, Vector3 targetDirection)
|
||||
{
|
||||
// 确保目标方向不是零向量
|
||||
if (targetDirection == Vector3.zero)
|
||||
return;
|
||||
return 0;
|
||||
|
||||
// 计算当前向上方向与目标方向之间的角度
|
||||
var angle = Mathf.Atan2(targetDirection.y, targetDirection.x) * Mathf.Rad2Deg;
|
||||
// 应用旋转
|
||||
transform.rotation = Quaternion.Euler(0f, 0f, angle);
|
||||
return angle;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user