(client) feat:添加消息定义,添加故事定义及其运算,武器动画可用,装备UI可用以及切换武器 fix:修复快速攻击导致协程释放出错卡死,重构为计时器,修复类型转换错误导致报错
This commit is contained in:
21
Client/Assets/Scripts/Utils/RotateTool.cs
Normal file
21
Client/Assets/Scripts/Utils/RotateTool.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Utils
|
||||
{
|
||||
public static class RotateTool
|
||||
{
|
||||
// 旋转对象到指定方向
|
||||
|
||||
public static void RotateTransformToDirection(Transform transform, Vector3 targetDirection)
|
||||
{
|
||||
// 确保目标方向不是零向量
|
||||
if (targetDirection == Vector3.zero)
|
||||
return;
|
||||
|
||||
// 计算当前向上方向与目标方向之间的角度
|
||||
var angle = Mathf.Atan2(targetDirection.y, targetDirection.x) * Mathf.Rad2Deg;
|
||||
// 应用旋转
|
||||
transform.rotation = Quaternion.Euler(0f, 0f, angle);
|
||||
}
|
||||
}
|
||||
}
|
3
Client/Assets/Scripts/Utils/RotateTool.cs.meta
Normal file
3
Client/Assets/Scripts/Utils/RotateTool.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d25c353b3bed400f92bccc0986b22420
|
||||
timeCreated: 1757241772
|
Reference in New Issue
Block a user