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