using System.Collections; using System.Collections.Generic; using UnityEngine; namespace WK { public abstract class Command { public abstract void Execute(); } /// /// 保存一些列cmd并在需要时按顺序执行 /// public class CommandList { private List m_Commands = new List(); public void AddCommand(Command cmd) { if (cmd == null) { return; } m_Commands.Add(cmd); } public void RemoveCommand(Command cmd) { if (cmd == null) { return; } m_Commands.Remove(cmd); } public void Execute() { for (int i = 0; i < m_Commands.Count; ++i) { m_Commands[i].Execute(); } } } }