IEnumerator Coroutine_Response() { if (mResponseIndex == mCurrentQuestion.CorrectAnswerIndex) { mFsm.SetCurrentState((int)GameState.StateID.SHOW_RESULTS); yield return(StartCoroutine(AmbientSound.Coroutine_PlayShot(mAudioSource, mAudioClipResponse, 0.50f))); } else { mFsm.SetCurrentState((int)GameState.StateID.SHOW_RESULTS); yield return(StartCoroutine(AmbientSound.Coroutine_PlayShot(mAudioSource, mAudioClipNoResponse, 0.75f))); } }
public void AddToGrid(Block blk) { StartCoroutine(AmbientSound.Coroutine_PlayShot(mAudioSource, mAddToGridAudioClip)); // Manual reverse iteration is possible using the GetChild() and childCount variables // Using normal forward traversal we cannot remove the parent. for (int i = blk.transform.childCount - 1; i >= 0; --i) { Transform child = blk.transform.GetChild(i); child.SetParent(null, true); int x = Mathf.RoundToInt(child.transform.position.x); int y = Mathf.RoundToInt(child.transform.position.y); mGrid[x, y] = child; } }
public IEnumerator Coroutine_StartCountDown(float totalTime) { mBackground.gameObject.SetActive(true); mTextTimer.gameObject.SetActive(true); int t = (int)totalTime; while (t != 0) { mTextTimer.text = t.ToString(); StartCoroutine(AmbientSound.Coroutine_PlayShot(mAudioSource, mAudioClip)); yield return(new WaitForSeconds(1.0f)); t -= 1; } mTextTimer.gameObject.SetActive(false); mBackground.gameObject.SetActive(false); OnFinishCountDown?.Invoke(); }
IEnumerator Coroutine_RemoveLines() { int id = CheckIfNeedToClearLines(); while (id != -1) { yield return(StartCoroutine(RemoveLine(id))); id = CheckIfNeedToClearLines(); //yield return new WaitForSeconds(1.0f); yield return(StartCoroutine(AmbientSound.Coroutine_PlayShot(mAudioSource, mClearLineAudioClip))); } if (mLinesRemoved >= GetLinesToClearLevel(mLevel)) { mFsm.SetCurrentState((int)GameState.StateID.NEW_LEVEL); } else { mFsm.SetCurrentState((int)GameState.StateID.PLAYING); } }
void OnEnterNewLevel() { StartCoroutine(AmbientSound.Coroutine_PlayShot(mAudioSource, mLevelUpAudioClip)); StartCoroutine(Coroutine_LevelUp()); }
void OnEnterLost() { StartCoroutine(AmbientSound.Coroutine_PlayShot(mAudioSource, mLostAudioClip)); StartCoroutine(Coroutine_OnLost()); //Debug.Log("Game ended"); }
IEnumerator Coroutine_NoResponse() { mFsm.SetCurrentState((int)GameState.StateID.SHOW_RESULTS); yield return(StartCoroutine(AmbientSound.Coroutine_PlayShot(mAudioSource, mAudioClipNoResponse))); }