Files
SVSimServer/SVSim.BattleEngine/Engine/Wizard/TweenAnimationGroup.cs
gamer147 824309ec44 feat(battle-engine): close the AI-simulation subsystem (verbatim)
Copied the 89 uncopied AI*SimulationUtility/extension files defining the
AIVirtualCard/AIVirtualField extension methods; the compile loop then auto-closed
the revealed type deps (~3049 files total, drift-clean). 10.0k -> 62 errors.
2026-06-05 20:30:59 -04:00

90 lines
1.9 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Cute;
using UnityEngine;
namespace Wizard;
[ExecuteAlways]
public class TweenAnimationGroup : MonoBehaviour
{
private List<TweenAnimation> _tweenAnimationList = new List<TweenAnimation>();
[SerializeField]
private ParticleSystem _effect;
[SerializeField]
private float _effectDelayTime;
[SerializeField]
private GameObject[] _gameObjects;
public void Play(Action onComplete)
{
CollectTweenAnimation();
foreach (TweenAnimation tweenAnimation in _tweenAnimationList)
{
tweenAnimation.Play();
}
if (UIManager.GetInstance() != null)
{
UIManager.GetInstance().StartCoroutine(OnPlayComplete(onComplete));
UIManager.GetInstance().StartCoroutine(PlayEffect(_effectDelayTime));
}
else
{
StartCoroutine(OnPlayComplete(onComplete));
StartCoroutine(PlayEffect(_effectDelayTime));
}
}
private IEnumerator OnPlayComplete(Action onComplete)
{
if (onComplete != null)
{
while (!AnimationAllEnd())
{
yield return null;
}
onComplete.Call();
}
}
private IEnumerator PlayEffect(float delay)
{
if (!(_effect == null))
{
_effect.gameObject.SetActive(value: false);
_effect.gameObject.transform.position = base.gameObject.transform.position;
yield return new WaitForSeconds(delay);
_effect.gameObject.SetActive(value: true);
}
}
private bool AnimationAllEnd()
{
bool flag = true;
foreach (TweenAnimation tweenAnimation in _tweenAnimationList)
{
flag &= tweenAnimation.IsPlayEnd();
}
return flag;
}
private void CollectTweenAnimation()
{
_tweenAnimationList = base.gameObject.GetComponentsInChildren<TweenAnimation>().ToList();
}
public GameObject GetChildObject(int index)
{
if (index < _gameObjects.Length)
{
return _gameObjects[index];
}
return null;
}
}