public void CheckButtonSelected(Button button) { if (queueButtons.Any() && button == queueButtons.Peek()) { queueButtons.Dequeue(); button.Activate(); SequenceChanged?.Invoke(queueButtons.Count); } else { Debug.Log("Game was stopped by losing"); QueueReady?.Invoke(false); LoseLevel?.Invoke(); } }
private IEnumerator CollectQueue() { queueButtons = new Queue <Button>(); Button button; for (int i = 0; i < queueLength; i++) { button = childButtons[UnityEngine.Random.Range(0, childButtons.Count)]; queueButtons.Enqueue(button); button.PutInQueue(); yield return(new WaitForSeconds(activateButtonDelay)); } QueueReady?.Invoke(true); }