예제 #1
0
    IEnumerator ShuffleBoardRoutine()
    {
        List <GamePiece> allPieces = new List <GamePiece>();

        foreach (GamePiece piece in m_allGamePieces)
        {
            allPieces.Add(piece);
        }

        while (!FinishedCollapsing(allPieces))
        {
            yield return(null);
        }

        List <GamePiece> normalPieces = m_boardShuffler.RemoveNormalPieces(m_allGamePieces);

        m_boardShuffler.ShuffleList(normalPieces);
        FillBoardFromList(normalPieces);
        m_boardShuffler.MovePieces(m_allGamePieces, swapTime);

        //try not to create match on shuffle
        List <GamePiece> matches = FindAllMatches();

        StartCoroutine(ClearAndRefillBoardRoutine(matches));
    }
예제 #2
0
    private IEnumerator ShuffleBoardRoutine()
    {
        List <GamePiece> allgamePieces = new List <GamePiece>();

        foreach (GamePiece piece in gamePiecesArray)
        {
            allgamePieces.Add(piece);
        }

        while (!IsCollapsed(allgamePieces))
        {
            yield return(null);
        }

        List <GamePiece> normalPieces = m_boardShuffler.RemoveNormalPieces(gamePiecesArray);

        m_boardShuffler.ShuffleList(normalPieces);

        FillBoardFromList(normalPieces);

        m_boardShuffler.MovePieces(gamePiecesArray, .5f);

        List <GamePiece> matches = FindAllMatches();

        StartCoroutine(ClearAndRefillBoardRoutine(matches));
    }
예제 #3
0
    IEnumerator ShuffleBoardRoutine()
    {
        List <GamePiece> allPieces = new List <GamePiece>();

        foreach (GamePiece piece in m_allGamePieces)
        {
            allPieces.Add(piece);
        }

        while (!IsCollapsed(allPieces)) //any pieces still in motion, while it collapsing, it returns null.
        {
            yield return(null);         //wait for frame.
        }

        List <GamePiece> normalPieces = m_boardShuffler.RemoveNormalPieces(m_allGamePieces);

        m_boardShuffler.ShuffleList(normalPieces);

        FillBoardFromList(normalPieces);

        m_boardShuffler.MovePieces(m_allGamePieces, swapTime);

        List <GamePiece> matches = FindAllMatches();

        StartCoroutine(ClearAndRefillBoardRoutine(matches));
    }
예제 #4
0
    //using the method and putting it in shuffleboard method. its like saying: "ShuffleBoard! Here, take it."
    public void ShuffleBoard()
    {
        //to gather list of normal gamepieces on the board
        List <GamePiece> normalPieces = m_boardShuffler.RemoveNormalPieces(m_allGamePieces);

        //shuffling the list that is taken using the method from BoardShuffler
        m_boardShuffler.ShuffleList(normalPieces);

        //using the list of shuffled pieces in FillBoard from the list method and then fills the array randomly
        FillBoardFromList(normalPieces);

        //since now array is filled up, move everything to its proper place
        m_boardShuffler.MovePieces(m_allGamePieces, swapTime);
    }