1
This commit is contained in:
@@ -228,6 +228,9 @@ public class MonsterContral : MonoBehaviour
|
||||
/// <summary>扇形(700)/圈(701)分布角方向:Init时按轴读生成姿态前方的XY投影,每条鱼各自不同</summary>
|
||||
private Vector2 _yzMoveDir = Vector2.zero;
|
||||
|
||||
/// <summary>阵鱼定位数值是否已打日志(一次性诊断用,池复用重置)</summary>
|
||||
private bool _yzPosLogged;
|
||||
|
||||
/// <summary>
|
||||
/// yzID 前3字符前缀缓存(Init 时 Substring 一次)。
|
||||
/// 避免 UpdateYZMovement 每帧每鱼 yzID.Substring(0,3) 产生字符串 GC 分配。
|
||||
@@ -405,6 +408,7 @@ public class MonsterContral : MonoBehaviour
|
||||
mainCamera = Camera.main;
|
||||
moveTime = 0f;
|
||||
yzGroupTimeOffset = 0f; // 池复用清掉上次的阵鱼创建偏移
|
||||
_yzPosLogged = false; // 池复用重置一次性定位日志
|
||||
// ⭐ 重置创建视频状态:池回收的鱼 _isPlayingCreateVideo 可能残留 true,
|
||||
// 重新生成时重置,由 Init 决定是否重新播放
|
||||
_createVideoDuration = 0f;
|
||||
@@ -731,6 +735,18 @@ public class MonsterContral : MonoBehaviour
|
||||
// ⭐ 加上创建时刻偏移:先创建的组已经游出去,后创建的从出生点出发,避免重合在同一点
|
||||
Vector2 pos = (Vector2)_yzStartWorld + lineDir * (moveTime + yzGroupTimeOffset) * monsterData.moveLine.moveTime;
|
||||
|
||||
// ⭐ 一次性诊断日志:输出阵鱼定位的各项数值(排查"偏移距离太小")
|
||||
if (!_yzPosLogged)
|
||||
{
|
||||
_yzPosLogged = true;
|
||||
var cam = mainCamera != null ? mainCamera : Camera.main;
|
||||
float worldW = cam != null ? cam.orthographicSize * 2f * cam.aspect : 0f;
|
||||
Debug.Log($"[阵鱼定位] guid={guid} yzID={yzID} prefix={_yzPrefix} " +
|
||||
$"start={_yzStartWorld.ToString("F2")} dir={_yzMoveDir.ToString("F3")} " +
|
||||
$"moveTime={moveTime:F3} offset={yzGroupTimeOffset:F3} speed={monsterData.moveLine.moveTime:F2} " +
|
||||
$"pos={pos.ToString("F2")} 屏幕世界宽={worldW:F2} isMove={isMove} isyz={isyz}");
|
||||
}
|
||||
|
||||
// ⭐ 朝向保持生成姿态(分布角)不转——不调 ApplyFacingDirection:
|
||||
// 它会覆盖根的分布角,把扇形/圈抹成一列竖队
|
||||
// ⭐ 保留根节点当前 z(2D 小鱼 z 一直为 0,行为不变)
|
||||
|
||||
Reference in New Issue
Block a user