// Update is called once per frame void Update() { //터치 시작 if (_touchDownCur >= 0) { Tile t = _tiles[_touchDownCur]; t.SetSelect(true); _iFirstTileCur = _touchDownCur; _iSecondTileCur = -1; } //드래그 중 if (_touchEnterCur >= 0) { if (IsSide(_iFirstTileCur, _touchEnterCur) == true) { //Debug.Log("---- " + _touchEnterCur); Tile t = _tiles[_touchEnterCur]; t.SetSelect(true); // 선택한 두 타일 바꾸기 SwapTiles(_iFirstTileCur, _touchEnterCur); _iSecondTileCur = _touchEnterCur; _touchEnterCur = -1; _touchDownCur = -1; } } //드래그 끝 if (_touchUpCur >= 0) { if (_iFirstTileCur >= 0) { Tile t = _tiles[_iFirstTileCur]; t.SetSelect(false); _iFirstTileCur = -1; } if (_iSecondTileCur >= 0) { Tile t = _tiles[_iSecondTileCur]; t.SetSelect(false); _iSecondTileCur = -1; } _touchUpCur = -1; } //타일 터트리기 while (_listPangTiles.Count > 0) { List <int> listTemp = new List <int>(); foreach (int one in _listPangTiles) { listTemp.Add(one); } _listPangTiles.Clear(); listTemp.Sort(CompareDepts); foreach (int one in listTemp) { Pang(one); AddWaitingTile(one); } } //이동 후 만들어지는 폭탄 생성 foreach (int one in _listBombTiles) { _tiles[one].SetBomb(_tiles[one]._idx); } _listBombTiles.Clear(); //특수 타일 - 팽이 if (_listTopTiles.Count > 0) { foreach (int one in _listTopTiles) { _tiles[one].Damaged(); if (_tiles[one]._iLife <= 0 && _questCnt > 0) { _questCnt--; } } _listTopTiles.Clear(); _uiMng.SetQuestCnt(_questCnt); } if (_listWaitingTiles.Count > 0) { List <int> listTemp = new List <int>(); foreach (int one in _listWaitingTiles) { listTemp.Add(one); } _listWaitingTiles.Clear(); listTemp.Sort(CompareDepts); foreach (int one in listTemp) { MoveDownAfterPang(one); } } if (_listWaitingTiles.Count < 1) { FindPangFromList(); } if (_listPangTiles.Count < 1) { if (_questCnt <= 0) { _uiMng.SetEndUI(true); } else if (_moveCnt <= 0) { _uiMng.SetEndUI(false); } } }