23 lines
864 B
C#
23 lines
864 B
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace Ichni.RhythmGame
|
|
{
|
|
public class AnimationManager : MonoBehaviour
|
|
{
|
|
// 如果你的动画拆分为了独立的类别,也可以分开成多个 List
|
|
private List<AnimationBase> _activeAnimations = new List<AnimationBase>(200);
|
|
|
|
public void RegisterAnimation(AnimationBase anim) => _activeAnimations.Add(anim);
|
|
public void UnregisterAnimation(AnimationBase anim) => _activeAnimations.Remove(anim);
|
|
|
|
public void ManualUpdate(float currentSongTime)
|
|
{
|
|
// 倒序遍历以防在更新途中某个动画自行销毁
|
|
for (int i = _activeAnimations.Count - 1; i >= 0; i--)
|
|
{
|
|
if(_activeAnimations[i].isActiveAndEnabled) _activeAnimations[i].ManualUpdate(currentSongTime);
|
|
}
|
|
}
|
|
}
|
|
} |