using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
///
/// 战斗队列
///
public class BattleQueue {
/// 执行队列
public Queue queue = new Queue();
/// 战斗合集
public List characters = new List();
/// 添加角色
public void Add(List list) {
characters.AddRange(list);
}
/// 添加角色
public void Add(BattleCharacter character) {
characters.Add(character);
}
/// 遍历角色
public void ForEach(Action action) {
characters.ForEach(action);
}
// /// 排序:大到小
public void OrderByDescending(Func func) {
characters = characters.OrderByDescending(func).ToList();
}
/// 更新队列
public void UpdateQueue() {
queue = new Queue(characters);
}
/// 取出一个
public bool Dequeue(out BattleCharacter battle) {
battle = queue.Count > 0 ? queue.Dequeue() : null;
return battle != null;
}
}