private IEnumerator MoveToNext() { Tile tile = CurrentTile.GetComponent <Tile>(); var t = boardScript.MoveNext(tile, dir); if (t != null) { CurrentTile = t.gameObject; StartTime = Time.time; t.ChangeStatus(Tile.TileStatus.Used); yield return(new WaitForSeconds(MoveTime)); } else { Debug.Log("You hit a wall!"); } IsMoving = false; }