void AfterBfsMove(TileInfoTutorial endTile, int tileStage)
    {
        TileInfoTutorial        pathSave = endTile;
        List <TileInfoTutorial> tileList = new List <TileInfoTutorial>();

        if (tileStage == 0)
        {
            tileList.Add(pathSave);
            Debug.Log("aaa");
        }
        else
        {
            tileList.Add(pathSave);
            for (int i = 0; i < tileStage; i++)
            {
                tileList.Add(pathSave.path);
                pathSave = pathSave.path;
            }
        }

        /*else if(tileStage == 1)
         * {
         *  tileList.Add(pathSave);
         *  tileList.Add(pathSave.path);
         *
         * }*/

        StartCoroutine(UnitMove(tileList, tileStage, selectUnit));
    }
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space) && selectUnit.movingEnd == true)
        {
            GetGotoTile(selectUnit.startPoint, selectUnit.actPoint);
        }

        Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit))
        {
            if (Input.GetMouseButtonDown(0))
            {
                if (hit.transform.tag == "Tile")
                {
                    TileInfoTutorial rayTile = hit.transform.GetComponent <TileInfoTutorial>();

                    Debug.Log("a");

                    if (rayTile.selectTile == true)
                    {
                        AfterBfsMove(rayTile, rayTile.stage);
                        AllTileBreak();
                    }
                }
                if (hit.transform.tag == "Unit")
                {
                    selectUnit = hit.transform.GetComponent <UnitInfoTutorial>();
                }
            }
        } //stage
    }
    IEnumerator StopMoving()
    {
        yield return(new WaitForSeconds(0.5f));

        moving     = false;
        startPoint = endPoint;
    }
    void GetGotoTile(TileInfoTutorial startTile, int actPoint)
    {
        if (actPoint == 0)
        {
            return;
        }

        startTile.firstTile = true;

        listFirst  = 0;
        listSize   = 1;
        listSwitch = 0;



        List <TileInfoTutorial> tileList = new List <TileInfoTutorial>();

        tileList.Add(startTile);

        int tempStage = 0;                              //이것은 경로 추적에 중요하다

        for (int i = 0; i < actPoint; i++)              //행동력만큼 반복하며
        {
            for (int j = listSwitch; j < listSize; j++) //리스트에 들어있는 타일을 기준으로 찾으며
            {
                startLocX = tileList[j].X;
                startLocY = tileList[j].Y;



                for (int k = 0; k < 34; k++) //그것을 나의 타일들과 비교하여 맞는 조건의 타일을 구한다
                {
                    if (tileList[j].X % 2 == 0)
                    {
                        if (tileSaveInfo[k].X == startLocX && tileSaveInfo[k].Y == startLocY - 1 && tileSaveInfo[k].selectTile == false && tileSaveInfo[k].firstTile == false)
                        {
                            tileList.Add(tileSaveInfo[k]);
                            tileSaveInfo[k].selectTile = true;
                            tileSaveInfo[k].path       = tileList[j];
                            tileSaveInfo[k].stage      = tempStage;
                            listFirst++;
                        }
                        if (tileSaveInfo[k].X == startLocX && tileSaveInfo[k].Y == startLocY + 1 && tileSaveInfo[k].selectTile == false && tileSaveInfo[k].firstTile == false)
                        {
                            tileList.Add(tileSaveInfo[k]);
                            tileSaveInfo[k].selectTile = true;
                            tileSaveInfo[k].path       = tileList[j];
                            tileSaveInfo[k].stage      = tempStage;
                            listFirst++;
                        }
                        if (tileSaveInfo[k].X == startLocX + 1 && tileSaveInfo[k].Y == startLocY + 1 && tileSaveInfo[k].selectTile == false && tileSaveInfo[k].firstTile == false)
                        {
                            tileList.Add(tileSaveInfo[k]);
                            tileSaveInfo[k].selectTile = true;
                            tileSaveInfo[k].path       = tileList[j];
                            tileSaveInfo[k].stage      = tempStage;
                            listFirst++;
                        }
                        if (tileSaveInfo[k].X == startLocX + 1 && tileSaveInfo[k].Y == startLocY && tileSaveInfo[k].selectTile == false && tileSaveInfo[k].firstTile == false)
                        {
                            tileList.Add(tileSaveInfo[k]);
                            tileSaveInfo[k].selectTile = true;
                            tileSaveInfo[k].path       = tileList[j];
                            tileSaveInfo[k].stage      = tempStage;
                            listFirst++;
                        }
                        if (tileSaveInfo[k].X == startLocX - 1 && tileSaveInfo[k].Y == startLocY + 1 && tileSaveInfo[k].selectTile == false && tileSaveInfo[k].firstTile == false)
                        {
                            tileList.Add(tileSaveInfo[k]);
                            tileSaveInfo[k].selectTile = true;
                            tileSaveInfo[k].path       = tileList[j];
                            tileSaveInfo[k].stage      = tempStage;
                            listFirst++;
                        }
                        if (tileSaveInfo[k].X == startLocX - 1 && tileSaveInfo[k].Y == startLocY && tileSaveInfo[k].selectTile == false && tileSaveInfo[k].firstTile == false)
                        {
                            tileList.Add(tileSaveInfo[k]);
                            tileSaveInfo[k].selectTile = true;
                            tileSaveInfo[k].path       = tileList[j];
                            tileSaveInfo[k].stage      = tempStage;
                            listFirst++;
                        }
                    }
                    else
                    {
                        if (tileSaveInfo[k].X == startLocX && tileSaveInfo[k].Y == startLocY - 1 && tileSaveInfo[k].selectTile == false && tileSaveInfo[k].firstTile == false)
                        {
                            tileList.Add(tileSaveInfo[k]);
                            tileSaveInfo[k].selectTile = true;
                            tileSaveInfo[k].path       = tileList[j];
                            tileSaveInfo[k].stage      = tempStage;
                            listFirst++;
                        }
                        if (tileSaveInfo[k].X == startLocX && tileSaveInfo[k].Y == startLocY + 1 && tileSaveInfo[k].selectTile == false && tileSaveInfo[k].firstTile == false)
                        {
                            tileList.Add(tileSaveInfo[k]);
                            tileSaveInfo[k].selectTile = true;
                            tileSaveInfo[k].path       = tileList[j];
                            tileSaveInfo[k].stage      = tempStage;
                            listFirst++;
                        }
                        if (tileSaveInfo[k].X == startLocX + 1 && tileSaveInfo[k].Y == startLocY - 1 && tileSaveInfo[k].selectTile == false && tileSaveInfo[k].firstTile == false)
                        {
                            tileList.Add(tileSaveInfo[k]);
                            tileSaveInfo[k].selectTile = true;
                            tileSaveInfo[k].path       = tileList[j];
                            tileSaveInfo[k].stage      = tempStage;
                            listFirst++;
                        }
                        if (tileSaveInfo[k].X == startLocX + 1 && tileSaveInfo[k].Y == startLocY && tileSaveInfo[k].selectTile == false && tileSaveInfo[k].firstTile == false)
                        {
                            tileList.Add(tileSaveInfo[k]);
                            tileSaveInfo[k].selectTile = true;
                            tileSaveInfo[k].path       = tileList[j];
                            tileSaveInfo[k].stage      = tempStage;
                            listFirst++;
                        }
                        if (tileSaveInfo[k].X == startLocX - 1 && tileSaveInfo[k].Y == startLocY - 1 && tileSaveInfo[k].selectTile == false && tileSaveInfo[k].firstTile == false)
                        {
                            tileList.Add(tileSaveInfo[k]);
                            tileSaveInfo[k].selectTile = true;
                            tileSaveInfo[k].path       = tileList[j];
                            tileSaveInfo[k].stage      = tempStage;
                            listFirst++;
                        }
                        if (tileSaveInfo[k].X == startLocX - 1 && tileSaveInfo[k].Y == startLocY && tileSaveInfo[k].selectTile == false && tileSaveInfo[k].firstTile == false)
                        {
                            tileList.Add(tileSaveInfo[k]);
                            tileSaveInfo[k].selectTile = true;
                            tileSaveInfo[k].path       = tileList[j];
                            tileSaveInfo[k].stage      = tempStage;
                            listFirst++;
                        }
                    }
                } // 6개 구해주는 for문
            }
            listSize   = tileList.Count;
            listSwitch = listSize - listFirst;
            listFirst  = 0;


            tempStage++;
            Debug.Log("tttt" + tempStage);
        }


        startTile.firstTile = false;
    }