Пример #1
0
        void Update()
        {
            if (gameover)
            {
                return;
            }
            int speed = (int)eggController.speed;

            levelsMenuController.tipSpeed.text = speed + "";
            int score = (int)eggController.flyingLength;

            levelsMenuController.tipHeight.ChangeValue(score);
            scoreController.RecordScore(score);

            if (!gameComplete)
            {
                ShowSpeed(speed);

                ContinuePoint lastCp = getNearContinuePositionC(eggController.transform.position.y);
                if (null != lastCp)
                {
                    if (null == lastSavePoint || lastCp != lastSavePoint)
                    {
                        lastSavePoint = lastCp;
                        lableSavePoint.Fade("Reached savepoint!");
                    }
                }
            }
        }
Пример #2
0
        private ContinuePoint getNearContinuePositionC(float y)
        {
            ContinuePoint lastitem = null;

            foreach (ContinuePoint item in continuePoints)
            {
                //				Log.Info ("-----item {0} - {1}. >> {2}",item.name,item.transform.position,y);

                if (item.transform.position.y < y)
                {
                    continue;
                }
                float dis = Math.Abs(item.transform.position.y - y);
                if (null != lastitem)
                {
                    if (Math.Abs(lastitem.transform.position.y - y) > dis)
                    {
                        lastitem = item;
                    }
                }
                else
                {
                    lastitem = item;
                }
            }

            return(lastitem);
        }
Пример #3
0
    private void ContinueGameProcess()
    {
        isPaused = false;

        if (continuePoint != null)
        {
            Debug.Log("continued saved process");
            continuePoint();
            continuePoint = null;
        }
        //else
        //{
        //    //Debug.Log("there is no saved process");
        //}
    }
Пример #4
0
        private Vector3 getNearContinuePosition(float y)
        {
            ContinuePoint lastitem = getNearContinuePositionC(y);

            if (null == lastitem)
            {
                Log.Info("can not found last cunitnue run point. {0}", y);
                return(Vector3.zero);
            }
            else
            {
                Log.Info("found last cunitnue run point {0} - {1} - {2}.", lastitem.name, lastitem.transform.position, y);
                return(lastitem.transform.position);
            }
        }
Пример #5
0
    public IEnumerator PlayCorrectThenLDSound()
    {
        //if it's question 6-15, correct answer sound's index is calculating automatically (5*i-10) | LD index is calculating automatically (5*i-9)
        musicAudioSource.Stop();
        musicAudioSource.PlayOneShot(classicModeAudio[5 * currentQuestionNumber - 10]);
        Debug.Log("Sound: " + classicModeAudio[5 * currentQuestionNumber - 10].name + "length " + classicModeAudio[5 * currentQuestionNumber - 10].length);
        yield return(new WaitForSeconds(classicModeAudio[5 * currentQuestionNumber - 10].length + 0.2f));

        musicAudioSource.Stop();
        LightAnimation.SmallCircleDown();
        musicAudioSource.PlayOneShot(classicModeAudio[5 * currentQuestionNumber - 9]);
        Debug.Log("Sound: " + classicModeAudio[5 * currentQuestionNumber - 9].name + "length " + classicModeAudio[5 * currentQuestionNumber - 9].length);
        yield return(new WaitForSeconds(4f)); //classicModeAudio[5 * currentQuestionNumber - 9].length);

        if (GameProcess.isPaused)
        {
            continuePoint = LoadQuestion;
        }
        else
        {
            LoadQuestion();
        }
    }