예제 #1
0
    public IEnumerator fairMove()
    {
        yield return(new WaitForSeconds(.5f));

        if (otherCharacter != null)
        {
            //If swap did not yield a match, swap characters back
            if (!isMatched && !otherCharacter.GetComponent <character>().isMatched)
            {
                otherCharacter.GetComponent <character>().row    = row;
                otherCharacter.GetComponent <character>().column = column;
                row    = prevRow;
                column = prevCol;

                yield return(new WaitForSeconds(.5f));

                ourgrid.currentState = GameState.move;
            }
            //Else the match was successfull and must be DESTROYED
            else
            {
                ourgrid.DestroyMatches();
            }
            otherCharacter = null;
        }
        else
        {
            ourgrid.currentState = GameState.move;
        }
    }