public void MoveUpLetterPrefab(Transform _trfLetterPrefab, Transform _trfMoveTo, eBaseTeamType _team, bool _isAnswerGood = true) { _trfLetterPrefab.position = m_positionStartLetterPrefabs; _trfLetterPrefab.DOMove(Vector3.zero, m_timeMoveUpLetterPrefab) .SetEase(m_easeTypeMoveUpLetterPrefab) .OnComplete(() => MoveDownLetterPrefab(_trfLetterPrefab, _trfMoveTo, _team, _isAnswerGood)); _trfLetterPrefab.DOScale(Vector3.one * m_valueScaleLetterPrefab, m_timeMoveUpLetterPrefab) .SetEase(m_easeTypeScaleLetterPrefab); }
// set up show letter on screen private void OnCompleteMoveDownLetter(Transform _trfLetterRoot, string _letter, eBaseTeamType _team, bool _isGoodAnswer) { ManagerObject.Instance.SpawnObjectByType(eObjectType.par_pickup, ePoolName.ObjectPool).transform.position = _trfLetterRoot.position; _trfLetterRoot.GetComponent <MyLetter>().SetUpStart(_letter, _team); if (!CheckIsFinish()) { Help.Instance.CheckLetterForHelp(_isGoodAnswer); } // check for help }
public void SetUpStart(string _letter, eBaseTeamType _team) { MyLetter = _letter; switch (_team) { case eBaseTeamType.NONE: m_myImage.color = m_NoneColor; break; case eBaseTeamType.TEAM_BLUE: m_myImage.color = Color.green; break; case eBaseTeamType.TEAM_RED: m_myImage.color = Color.red; break; } }
//check letter when tracking found letter //return : true:gameend , fasle:next tracking public void CheckLetterTrackable(string _letter, eBaseTeamType _team) { if (GameController.Instance.m_keyWord.CheckLetterIsGood(_letter)) //> good answer { // create prefabs good when letter no exist LetterSpawn.Instance.DoWithLetterGood(_letter, _team); } else //> fail anwser { LetterSpawn.Instance.DoWithLetterFail(_letter, _team); if (GamePlayConfig.Instance.TypeShowQuestion == QuestionType.QS_SOUND) { QuestionManager.Instance.SetRespeakQuestion(); } } GameController.Instance.DoStopRemind();//check stop remind GameController.Instance.StartAutoShowLetter(); }
public void SetUpStart(string _letter, eBaseTeamType _team, bool _isLetterFail = true) { this.transform.localScale = Vector3.one; GetComponent <RectTransform>().sizeDelta = LetterGoodSpawner.Instance.SizeOfGrid; MyLetter = _letter.ToUpper(); m_team = _team; //isActive = true; switch (_team) { case eBaseTeamType.TEAM_BLUE: m_myImage.color = Color.green; break; case eBaseTeamType.TEAM_RED: m_myImage.color = Color.red; break; case eBaseTeamType.NONE: // set in single play mode SetUpColorWithLose(_isLetterFail); break; } }
// create prefabs letter fail when tracking // return : true : da ton tai , false :chua ton tai public void DoWithLetterFail(string _letter, eBaseTeamType _team) { if (CheckLetterFailIsTracked(_letter)) // existed { AudioManager.Instance.PlayAudioByLetter(_letter); EffectWithLetterFailExist(_letter); } else { AudioManager.Instance.PlayLetterWithAnswer(_letter, false); GameObject letterPrefabs = ManagerObject.Instance.SpawnObjectByType(eObjectType.Letter_Prefabs, ePoolName.pool); letterPrefabs.GetComponent <UILetter>().SetUpStart(_letter, _team); MoveUpLetterPrefab(letterPrefabs.transform, m_arrayLetterFail[IndexOfLetterFail].transform, _team, false); if (GamePlayConfig.Instance.UserPlayMode == eUserPlayMode.SINGLE_PLAY) { GameController.Instance.m_scoreManager.DecreaseScoreOfWord(); } //onCheckLetterHelp(false); IndexOfLetterFail++; m_allLetterFailTrackingFail += _letter; } }
// create prefabs letter good when tracking // check letter Exist ? public void DoWithLetterGood(string _letter, eBaseTeamType _team) { // get show if (GameController.Instance.m_keyWord.CheckLetterTracked(_letter)) { AudioManager.Instance.PlayAudioByLetter(_letter); LetterGoodSpawner.Instance.EffectWithLetterExist(_letter); } else { List <int> listIndexLetterInWord = GameController.Instance.m_keyWord.GetIndexLetterInWord(_letter); AudioManager.Instance.PlayLetterWithAnswer(_letter, true); for (int i = 0; i < listIndexLetterInWord.Count; i++) { GameObject letterPrefabs = ManagerObject.Instance.SpawnObjectByType(eObjectType.Letter_Prefabs, ePoolName.pool); letterPrefabs.GetComponent <UILetter>().SetUpStart(_letter, _team, false); MoveUpLetterPrefab(letterPrefabs.transform, LetterGoodSpawner.Instance.GetTranformLetterByIndex(listIndexLetterInWord[i]), _team); //replace key word hide GameController.Instance.m_keyWord.ReplaceKeyHide(listIndexLetterInWord[i]); } listIndexLetterInWord.Clear(); } }
// move to root letter prefabs and check finish word or not private void MoveDownLetterPrefab(Transform _trfLetterPrefab, Transform _trfMoveTo, eBaseTeamType _team, bool _isAnswerGood) { _trfLetterPrefab.DOMove(_trfMoveTo.position, m_timeMoveUpLetterPrefab) .SetEase(m_easeTypeMoveUpLetterPrefab) .OnComplete(() => DespawnWhenComplete(_trfLetterPrefab, _trfMoveTo, _isAnswerGood)) .SetDelay(m_timeWaitMoveDown); _trfLetterPrefab.DOScale(Vector3.one, m_timeMoveUpLetterPrefab) .SetEase(m_easeTypeScaleLetterPrefab) .SetDelay(m_timeWaitMoveDown); //if(GamePlayConfig.Instance.UserPlayMode == eUserPlayMode.MULTI_PLAY) //{ // int scoreAddInMulti = -1; // if(_isAnswerGood) // { // scoreAddInMulti = 2; // } // GameController.Instance.m_scoreManager.DoAddScoreOfMulti(scoreAddInMulti,_team); //} }