示例#1
0
 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)));
     }
 }
示例#2
0
        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;
            }
        }
示例#3
0
    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();
    }
示例#4
0
        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);
            }
        }
示例#5
0
 void OnEnterNewLevel()
 {
     StartCoroutine(AmbientSound.Coroutine_PlayShot(mAudioSource, mLevelUpAudioClip));
     StartCoroutine(Coroutine_LevelUp());
 }
示例#6
0
 void OnEnterLost()
 {
     StartCoroutine(AmbientSound.Coroutine_PlayShot(mAudioSource, mLostAudioClip));
     StartCoroutine(Coroutine_OnLost());
     //Debug.Log("Game ended");
 }
示例#7
0
 IEnumerator Coroutine_NoResponse()
 {
     mFsm.SetCurrentState((int)GameState.StateID.SHOW_RESULTS);
     yield return(StartCoroutine(AmbientSound.Coroutine_PlayShot(mAudioSource, mAudioClipNoResponse)));
 }