Exemplo n.º 1
0
    /*
     * Refill board coroutine
     *
     */
    private IEnumerator RefillBoard_cor()
    {
        RefillBorad();          // Refill board

        yield return(new WaitForSeconds(destructionWaitTime));

        // Looks for matches
        if (CheckForMatches())
        {
            // Destroy and recursion
            isMatching = false;
            MatchedCoroutine();
        }
        else
        {
            // Clears the current match
            matchesManager.currentMatches.Clear();
            currentTile = null;

            // Deadlock check
            if (deadlock.IsGameDeadlocked())
            {
                deadlock.ShuffleBoard();
                yield return(new WaitForSeconds(destructionWaitTime * 2f));

                isMatching = false;
                MatchedCoroutine();
            }
            else
            {
                currentPlayerState = PlayerState.Active;
                isMatching         = false;
            }
        }
    }