feat(player): 添加玩家阵型保存功能

新增savedFormation字段用于存储玩家的阵型配置,
包括角色ID列表和对应的格子索引位置信息。
```
This commit is contained in:
huadexuan committed 2026-09-29 23:21:44 +08:00
1 parent e127da5416
commit 1abd0de32f
16 files changed
+432 -2930

No files matched your search

+26 -3
View File
@@ -276,6 +276,7 @@ public class UnitBase : MonoBehaviour
if (!summonerMode)
{
animator.SetInteger("speed", 0);
animator.speed = 1f; // 重置动画播放速度(修复攻击后动画变慢的问题)
}
}
@@ -401,11 +402,24 @@ public class UnitBase : MonoBehaviour
return Vector3.Distance(current, anchor) <= anchorArrivalDistance;
}
/// <summary>
/// 重置锚点位置到当前位置(用于复活等场景)
/// </summary>
public void ResetAnchorPosition()
{
anchorPosition = transform.position;
anchorInitialized = true;
}
private void ReturnToAnchor()
{
if (navAgent == null || !anchorInitialized)
{
if (!summonerMode) animator.SetInteger("speed", 0);
if (!summonerMode)
{
animator.SetInteger("speed", 0);
animator.speed = 1f; // 重置动画播放速度
}
return;
}
@@ -416,7 +430,11 @@ public class UnitBase : MonoBehaviour
if (!navAgent.isOnNavMesh)
{
if (!summonerMode) animator.SetInteger("speed", 0);
if (!summonerMode)
{
animator.SetInteger("speed", 0);
animator.speed = 1f; // 重置动画播放速度
}
return;
}
@@ -426,7 +444,11 @@ public class UnitBase : MonoBehaviour
navAgent.ResetPath();
transform.position = new Vector3(anchorPosition.x, transform.position.y, anchorPosition.z);
navAgent.nextPosition = transform.position;
if (!summonerMode) animator.SetInteger("speed", 0);
if (!summonerMode)
{
animator.SetInteger("speed", 0);
animator.speed = 1f; // 重置动画播放速度
}
return;
}
@@ -437,6 +459,7 @@ public class UnitBase : MonoBehaviour
nextPathUpdateTime = Time.time + PathUpdateInterval;
}
animator.SetInteger("speed", navAgent.velocity.sqrMagnitude > 0.01f ? 1 : 0);
animator.speed = 1f; // 确保移动时动画速度正常
}
//目标决策:只寻找 detectionRange 内的敌方战斗单位;范围内没有敌人时原地待机或回到锚点。