// invoke the ShuffleBoardRoutine (called by a button for testing) public void ShuffleBoard() { // only shuffle if the Board permits user input if (playerInputEnabled) { StartCoroutine(boardShuffler.ShuffleBoardRoutine(this)); } }
public IEnumerator ClearAndRefillBoardRoutine(List <Bubble> bubbles) { // Disable player input while the Board is collapsing/refilling playerInputEnabled = false; // Create a new List of Bubbles, using the initial list as a starting point List <Bubble> matches = bubbles; do { scoreMultiplier = 1; // Run the coroutine to clear the Board and collapse any columns to fill in the spaces yield return(StartCoroutine(ClearAndProcessRoutine(matches))); // Refill empty spaces from collapsing yield return(StartCoroutine(boardFiller.RefillRoutine())); // Find any subsequent matches and repeat the process matches = boardMatcher.FindAllMatches(); if (matches.Count > 0) { Debug.Log(matches.Count); } }while (matches.Count != 0); if (boardDeadlock.IsDeadlocked()) { yield return(new WaitForSeconds(m_delay)); yield return(StartCoroutine(boardShuffler.ShuffleBoardRoutine())); } // Re-enable player input playerInputEnabled = true; }