/// <summary> /// 更新动画项 /// </summary> /// <param name="ani"></param> void updateAnimationItem(AnimationExtend ani) { if (!ani.isPlaying() && !ani.isCurPlayed()) { ani.play(); } if (ani.isPlayed()) { onAnimationPlayed(ani); } }
/// <summary> /// 添加动画项 /// </summary> /// <param name="ani">动画项</param> /// <param name="force">是否直接添加到播放列表</param> public void add(AnimationExtend ani, bool force = false) { if (force) { playingAnimations.Add(ani); } else { animations.Enqueue(ani); } join(ani); }
/// <summary> /// 动画播放完毕回调 /// </summary> /// <param name="ani"></param> void onAnimationPlayed(AnimationExtend ani) { playingAnimations.Remove(ani); onPlayed?.Invoke(ani); }
/// <summary> /// 加入动画项 /// </summary> /// <param name="ani">动画项</param> public void join(AnimationExtend ani) { ani.controller = this; }