public void AddGameEvent(ShmupGameEvent gameEvent) { eventQueue.Enqueue(gameEvent); if (!queueRunning) { StartCoroutine(StartQueue()); } }
IEnumerator StartQueue() { queueRunning = true; while (queueRunning) { if (eventQueue.Count != 0) { if (!runningEvent) { ShmupGameEvent gameEvent = eventQueue.Dequeue(); gameEvent.RunEvent(); while (!gameEvent.EventCompleted()) { yield return(null); } } } yield return(null); } eventQueue.Clear(); }