using System.Collections; using System.Collections.Generic; using UnityEngine; namespace KairoEngine.Core { public class CommandInvoker : MonoBehaviour { static Queue commandBuffer; private void Awake() { commandBuffer = new Queue(); } public static void AddCommand(ICommand command) { commandBuffer.Enqueue(command); } void Update() { while(commandBuffer.Count > 0) { ICommand command = commandBuffer.Dequeue(); command.Execute(); } } } }