예제 #1
0
    IEnumerator Check_Move()
    {
        yield return(new WaitForSeconds(0.5f));

        if (otherTile != null)
        {
            if (!isMatched && !otherTile.GetComponent <tile>().isMatched)
            {
                if (gameObject.CompareTag("Special"))
                {
                    // Tugas Bonus : Special akan menghancurkan semua objek yang memiliki tag sama dengan otherTile,
                    // lalu tile yang hancur akan diisi lagi dengan method Decrease_Row()
                    StartCoroutine(Destroy_Tile_With_Tag(otherTile.tag));
                }

                else
                {
                    otherTile.GetComponent <tile>().row = row;
                    otherTile.GetComponent <tile>().col = col;
                    row = previousRow;
                    col = previousCol;

                    grid.gameManager.scoreMultiple = 1;
                }
            }
            else
            {
                grid.Destroy_Matches();
            }
        }
        otherTile = null;
    }