feat(archer): 更新弓箭手攻击系统

- 修改箭矢材质颜色为橙色调,提升视觉效果
- 删除场景中预设的箭矢对象,改为运行时动态生成
- 配置弓箭手单位支持远程攻击类型,设置正确的项目引用
- 调整弓箭手碰撞体中心偏移,改善物理表现
- 新增箭矢发射位置标记点,用于准确控制投射物生成
- 禁用动画根运动防止旋转叠加,确保移动控制一致
- 添加场景辅助线显示箭矢发射位置,便于调试定位
- 优化弓箭模型动画循环参数,改进播放流畅度
```
This commit is contained in:
huadexuan committed 2026-08-27 17:44:37 +08:00
1 parent fe3877dedb
commit 840867963d
6 files changed
+81 -125

No files matched your search

+20
View File
@@ -111,6 +111,9 @@ public class UnitBase : MonoBehaviour
animator = GetComponent<Animator>();
controller = GetComponent<CharacterController>();
worldHealthBar = GetComponent<WorldHealthBar>();
// 位移和朝向由 CharacterController 与 UnitBase 控制,避免攻击动画的根运动叠加旋转。
animator.applyRootMotion = false;
//记录初始坐标
startPos = transform.position;
randomTargetPos();
@@ -487,6 +490,23 @@ public class UnitBase : MonoBehaviour
controller.Move(Vector3.up * getVerticalVelocity() * Time.deltaTime);
}
// 在 Scene 视图中标记箭的发射位置和方向,便于调整空物体。
private void OnDrawGizmos()
{
if (projectileSpawnPoint == null)
{
return;
}
Vector3 position = projectileSpawnPoint.position;
Gizmos.color = Color.cyan;
Gizmos.DrawWireSphere(position, 0.08f);
Gizmos.DrawLine(position, position + projectileSpawnPoint.forward * 0.4f);
Gizmos.color = Color.green;
Gizmos.DrawLine(position, position + projectileSpawnPoint.up * 0.15f);
}
//随机目标点
private void randomTargetPos()
{