1
This commit is contained in:
@@ -4886,6 +4886,61 @@ public class GameMainPanel_FishBase : GameMainPanel_Base
|
||||
_frozenAnimSpeeds.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 冰冻期间某条鱼被击杀:把这条鱼单独从冰冻定格中解除。
|
||||
/// ⭐ 死亡必须优先于冰冻 —— 不少鱼的"消失"依赖动画流程往前走:
|
||||
/// - 雷皇龙/金龙(QL/JL)靠 FLZY_BOSS_AnimatorLeave(Animator 状态退出回调)回池,
|
||||
/// Animator.speed=0 时状态机不推进 → 状态永不退出 → 鱼打死了也不消失
|
||||
/// - Timeline 驱动的 Boss 靠 Timeline 信号死亡/离场 → 根 Playable 速度 0 时信号不触发
|
||||
/// - Spine 鱼靠动画播完/动画事件离场 → timeScale=0 时同样卡死
|
||||
/// 其他活着的鱼保持冰冻不变。
|
||||
/// </summary>
|
||||
public void UnfreezeFishAnimations(MonsterContral monster)
|
||||
{
|
||||
if (monster == null) return;
|
||||
|
||||
// 1) 恢复该鱼自身的动画速度(取出即从冰冻记录移除,避免解冻时二次恢复)
|
||||
foreach (var s in monster.GetComponentsInChildren<Spine.Unity.SkeletonAnimation>(true))
|
||||
{
|
||||
if (_frozenAnimSpeeds.TryGetValue(s, out var v)) { s.timeScale = (float)v; _frozenAnimSpeeds.Remove(s); }
|
||||
}
|
||||
foreach (var a in monster.GetComponentsInChildren<Animator>(true))
|
||||
{
|
||||
if (_frozenAnimSpeeds.TryGetValue(a, out var v)) { a.speed = (float)v; _frozenAnimSpeeds.Remove(a); }
|
||||
}
|
||||
foreach (var an in monster.GetComponentsInChildren<Animation>(true))
|
||||
{
|
||||
if (!_frozenAnimSpeeds.TryGetValue(an, out var v)) continue;
|
||||
if (v is List<float> stateSpeeds)
|
||||
{
|
||||
int i = 0;
|
||||
foreach (AnimationState state in an)
|
||||
{
|
||||
if (i < stateSpeeds.Count)
|
||||
state.speed = stateSpeeds[i];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
_frozenAnimSpeeds.Remove(an);
|
||||
}
|
||||
|
||||
// 2) 恢复该鱼体内的 Timeline(根 Playable 速度还原 → 时间轴继续推进,信号才能触发)
|
||||
foreach (var pd in monster.GetComponentsInChildren<UnityEngine.Playables.PlayableDirector>(true))
|
||||
{
|
||||
if (!_frozenDirectors.TryGetValue(pd, out var speed)) continue;
|
||||
var graph = pd.playableGraph;
|
||||
if (graph.IsValid())
|
||||
{
|
||||
for (int i = 0; i < graph.GetRootPlayableCount(); i++)
|
||||
graph.GetRootPlayable(i).SetSpeed(speed);
|
||||
}
|
||||
_frozenDirectors.Remove(pd);
|
||||
}
|
||||
|
||||
// 3) 脱掉冰壳:死亡/离场动画要能看见(冰壳是鱼的子物体,会跟着鱼一起回收)
|
||||
monster.SetFreezeEffect(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 还原冰冻期间被定格的 Timeline:恢复根 Playable 的原始速度(重新开始推进)。
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user