yyl
2025-09-16 8d8722604524e5eaaf92753949d6d4c7800ea8ee
125 特效持续播放问题解决
1个文件已修改
47 ■■■■ 已修改文件
Main/Component/UI/Effect/BattleEffectPlayer.cs 47 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/Component/UI/Effect/BattleEffectPlayer.cs
@@ -66,6 +66,10 @@
    public Action onComplete;
    private bool isPlaying = false;
    private float timer = 0f;
    protected virtual void OnEnable()
    {
        if (spineComp != null)
@@ -212,15 +216,34 @@
            this.gameObject.SetActive(true);
        }
        if (effectConfig.autoDestroy != 0)
        {
            GameObject.Destroy(gameObject, effectConfig.destroyDelay / speedRate);
        }
        isPlaying = true;
        timer = 0f;
        PlayEffect();
    }
    public void Run()
    {
        if (null == effectConfig)
        {
            return;
        }
        if (!isPlaying)
        {
            return;
        }
        if (effectConfig.autoDestroy != 0)
        {
            timer += Time.deltaTime * speedRate;
            if (timer >= effectConfig.destroyDelay)
            {
                GameObject.DestroyImmediate(gameObject);
            }
        }
    }
    protected virtual void PlayEffect()
@@ -451,7 +474,7 @@
    public void Pause()
    {
        if (effectTarget == null) return;
        // if (effectTarget == null) return;
        // Spine动画
        // var spineGraphics = effectTarget.GetComponentsInChildren<SkeletonGraphic>(true);
@@ -459,6 +482,11 @@
        if (spineComp != null)
        {
            spineComp.timeScale = 0f;
        }
        if (spineAnimationState != null)
        {
            spineAnimationState.TimeScale = 0f;
        }
        // Animator动画
@@ -476,13 +504,18 @@
    public void Resume()
    {
        if (effectTarget == null) return;
        // if (effectTarget == null) return;
        if (spineComp != null)
        {
            spineComp.timeScale = speedRate;
        }
        if (spineAnimationState != null)
        {
            spineAnimationState.TimeScale = speedRate;
        }
        // Animator动画
        foreach (var animator in animatorList)
        {