public IEnumerator AnimateLettersCO(float periodRatio, bool tutorialMode) { for (var iLetter = 0; iLetter < animDatas.Length; iLetter++) { var animData = animDatas[iLetter]; var llData = new LL_ImageData(animData.dataID); var gameLL = new GameLivingLetter(transform.parent, letterObjectViewPrefab, shadowPrefab, llData, animData.startPosTr.position - Vector3.up * animData.jumpHeight, transform.localPosition, animData.startPosTr.position, animData.timing * periodRatio, null, animData.scale, danceSpeedMultiplier); gameLetters.Add(gameLL); StartCoroutine(WaitThenAnimateCO(animData, gameLL, periodRatio)); } if (!tutorialMode) { mayDrop = true; yield return(new WaitForSeconds(waitBeforeStill * periodRatio)); for (var iLetter = 0; iLetter < animDatas.Length; iLetter++) { var animData = animDatas[iLetter]; var gameLL = gameLetters[iLetter]; gameLL.livingLetter.SetState(LLAnimationStates.LL_still); StartCoroutine(WaitThenDropCO(animData, gameLL, periodRatio)); } } }
private IEnumerator WaitThenAnimateCO(LetterAnimData animData, GameLivingLetter gameLL, float periodRatio) { yield return(new WaitForSeconds((animData.timing + 0.5f) * periodRatio)); gameLL.livingLetter.DancingSpeed = danceSpeedMultiplier; gameLL.livingLetter.SetState(LLAnimationStates.LL_dancing); yield return(new WaitForSeconds(animData.timing2 * periodRatio)); gameLL.livingLetter.DoTwirl(null); yield return(new WaitForSeconds(0f)); gameLL.livingLetter.SetState(LLAnimationStates.LL_dancing); }
private IEnumerator WaitThenDropCO(LetterAnimData animData, GameLivingLetter gameLL, float periodRatio) { yield return(new WaitForSeconds((waitBeforeCrouching + animData.timing3) * periodRatio)); if (!mayDrop) { yield break; } if (gameLL == null || gameLL.livingLetter == null) { yield break; } gameLL.livingLetter.SetState(LLAnimationStates.LL_dancing); gameLL.livingLetter.DoDancingLose(); gameLL.dropped = true; }