1
This commit is contained in:
@@ -304,6 +304,10 @@ public class MonsterContral : MonoBehaviour
|
||||
return col;
|
||||
}
|
||||
}
|
||||
// ⭐ 完全没配锚点的鱼(如 XJMH/FLZY 多数 Boss 预制体) → 回退用自身 transform,
|
||||
// 与 GameMainPanel_FishBase.ResolveLockTransform ⑤ 的回退规则一致
|
||||
if (lockPoint == null && (colliderList == null || colliderList.Count == 0))
|
||||
return transform;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -3169,7 +3169,14 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
|
||||
if (useHitCollider && monster.lockPoint != null && monster.lockPoint.gameObject.activeInHierarchy)
|
||||
return monster.lockPoint;
|
||||
|
||||
// ⑤ ⭐ lockPoint 和 colliderList 全部未激活 → 返回 null,调用方应换一条鱼
|
||||
// ⑤ ⭐ 区分两种情况:
|
||||
// - 完全没配锚点(lockPoint/colliderList 都为空,如 XJMH/FLZY 多数 Boss 预制体)
|
||||
// → 回退用鱼自身 transform,保证自动锁定能锁到这些 Boss
|
||||
// - 配了锚点但全部未激活(出场效果期间,如嫦娥/小白龙切换片段)
|
||||
// → 返回 null,调用方应换一条鱼
|
||||
if (monster.lockPoint == null && (monster.colliderList == null || monster.colliderList.Count == 0))
|
||||
return monster.transform;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -3184,7 +3191,10 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
|
||||
/// - needLockEvent=false 的鱼:一直可锁定(只要 activeInHierarchy)
|
||||
/// - needLockEvent=true 的鱼:出场/状态切换期间 isLockable=false,等 NotifyLockable() 后才可锁定
|
||||
/// - 已死亡的鱼(isDead=true,死亡特效播放窗口期)不可锁定
|
||||
/// 同时要求有激活的锁定锚点(lockPoint 或 colliderList 任一激活)
|
||||
/// - 锚点检查分两种情况:
|
||||
/// ① 配了锚点(lockPoint 或 colliderList 非空):要求至少一个激活,否则视为出场窗口期不可锁定
|
||||
/// ② 完全没配锚点(XJMH/FLZY 多数 Boss 预制体):视为一直可锁定,锁定点回退用鱼自身 transform
|
||||
/// ⭐ 否则这些 Boss 会被永久过滤,表现为"手动能锁、自动锁定永远锁不到Boss"
|
||||
/// </summary>
|
||||
private bool IsMonsterLockable(MonsterContral monster)
|
||||
{
|
||||
@@ -3193,7 +3203,11 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
|
||||
if (monster.isDead) return false;
|
||||
// ⭐ 可锁定事件控制:needLockEvent=true 的鱼未触发 NotifyLockable 前不可锁定
|
||||
if (!monster.isLockable) return false;
|
||||
// ⭐ 锚点激活检查:lockPoint 或 colliderList 任一激活
|
||||
// ⭐ 完全没配锚点 → 一直可锁定(锁定点回退 transform,见 ResolveLockTransform ⑤)
|
||||
bool hasAnchorConfig = monster.lockPoint != null
|
||||
|| (monster.colliderList != null && monster.colliderList.Count > 0);
|
||||
if (!hasAnchorConfig) return true;
|
||||
// ⭐ 配了锚点:要求 lockPoint 或 colliderList 任一激活
|
||||
if (monster.lockPoint != null && monster.lockPoint.gameObject.activeInHierarchy) return true;
|
||||
if (monster.colliderList != null)
|
||||
{
|
||||
@@ -3571,15 +3585,24 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
|
||||
// 激活后,当锁定的鱼死亡,自动转换到下一个目标
|
||||
if (!_autoLockActivated) return;
|
||||
|
||||
// 已经有锁定目标并且还活着,就不重复找
|
||||
// ⭐ 手动锁定:只看鱼是否还活着,不检查路径进度(玩家自己锁的鱼离场前一直跟)
|
||||
// 自动锁定:还要检查路径进度(超出 0.1~0.9 范围视为失效,换下一条)
|
||||
// 已经有锁定目标并且还活着
|
||||
// ⭐ 手动锁定:玩家自己选的鱼离场前一直跟,死亡后才自动转换(不自动升级)
|
||||
// ⭐ 自动锁定:目标活着时也要做"优先级升级"检查 —— 场上出现更高优先级的鱼
|
||||
// (例如Boss刚游过 0.1 路径进度变得可锁定)时立即切换过去。
|
||||
// 否则会一直锁着先选中的普通鱼直到它死,表现为"屏幕上还有大鱼却锁着普通鱼"
|
||||
if (currSitData.isLock &&
|
||||
currSitData.monCotl_Lock != null &&
|
||||
currSitData.monCotl_Lock.gameObject.activeInHierarchy &&
|
||||
(currSitData.isManualLock || IsFishPathLockable(currSitData.monCotl_Lock)))
|
||||
currSitData.monCotl_Lock.gameObject.activeInHierarchy)
|
||||
{
|
||||
return;
|
||||
// 手动锁定:死了才转换
|
||||
if (currSitData.isManualLock) return;
|
||||
|
||||
if (IsFishPathLockable(currSitData.monCotl_Lock))
|
||||
{
|
||||
// 当前目标仍有效 → 没有更高优先级目标就保持锁定,有就落到下面切换
|
||||
if (!HasHigherPriorityTarget(currSitData.monCotl_Lock)) return;
|
||||
}
|
||||
// 当前目标离场(超出 0.1~0.9) → 落到下面重新找目标
|
||||
}
|
||||
|
||||
// 当前锁定目标已死亡/失效 → 自动找下一个目标
|
||||
@@ -3595,6 +3618,8 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
|
||||
currSitData.isManualLock = false;
|
||||
currSitData.SetLockTarget(target, lockTr);
|
||||
SyncLock(new List<string> { target?.guid }, colliderIndex);
|
||||
// ⭐ 切换日志:输出新目标类型和优先级,方便验证优先级规则(特殊Boss5>Boss4>特殊鱼3>黄金鱼2>普通鱼1)
|
||||
Debug.Log($"[自动锁定] 切换目标 → {target.gameObject.name} 类型={target.fishenum} 优先级={GetFishLockPriority(target)}");
|
||||
|
||||
// ⭐ 切换目标瞬间立即更新主锁定图标(鱼还活着就一定显示)
|
||||
if (currSitData.lockFX != null && target.gameObject.activeInHierarchy)
|
||||
@@ -3687,6 +3712,30 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ⭐ 检查场上是否存在比 current 优先级严格更高的可锁定目标(自动锁定升级用)。
|
||||
/// 与 FindAutoLockTarget 使用完全相同的过滤条件(活跃/路径进度/可锁定)。
|
||||
/// 同优先级不算更高 —— 避免同层"距离最近"目标来回切换导致锁定图标抖动。
|
||||
/// </summary>
|
||||
private bool HasHigherPriorityTarget(MonsterContral current)
|
||||
{
|
||||
if (current == null || CreateFishManager.Instance == null ||
|
||||
CreateFishManager.Instance.fishDatas_hashCodekey == null)
|
||||
return false;
|
||||
|
||||
int currentPri = GetFishLockPriority(current);
|
||||
|
||||
foreach (var kv in CreateFishManager.Instance.fishDatas_hashCodekey)
|
||||
{
|
||||
MonsterContral m = kv.Value;
|
||||
if (m == null || m == current || !m.gameObject.activeInHierarchy) continue;
|
||||
if (!IsFishPathLockable(m)) continue;
|
||||
if (!IsMonsterLockable(m)) continue;
|
||||
if (GetFishLockPriority(m) > currentPri) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//private void HandleAutoLock()
|
||||
//{
|
||||
// if (!currSitData.IsAutoAttackOn) return;
|
||||
|
||||
@@ -298,7 +298,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastTarget: 0
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
|
||||
Reference in New Issue
Block a user