Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        // スライダー
        if (!mSliderLeft.enabled && (mTime >= 0.1f))
        {
            mSliderLeft.enabled  = true;
            mSliderRight.enabled = true;
        }

        // sSliderCameraSizeValue = GameObject.Find ("SliderCameraSize").GetComponent<Slider> ().value;
        // GameObject.FindWithTag ("MainCamera").GetComponent<Camera> ().orthographicSize = Mathf.Lerp (5.0f, 200.0f, sSliderCameraSizeValue);

        // sIsInvincible = GameObject.Find ("ToggleInvincible").GetComponent<Toggle> ().isOn;

        if (mIsDestroyed)
        {
            // if (Input.GetKey (KeyCode.Space) || ((Input.touchCount > 0 ) && (Input.GetTouch(0).phase == TouchPhase.Began))) {
            //	Application.LoadLevel ("Game");
            // }
            return;
        }

        CalcMove();

        CalcCollision();

        CalcParticle();

        mCoursePartIndex = mCourseManager.CheckInsideCoursePart(transform.position);
        if (mCoursePartIndex < 0)
        {
            mCoursePartIndex = 0;
        }
        mTextDistance.text = mCoursePartIndex.ToString();

        // コース幅変更
        float achievement = mCourseManager.CheckAchievement(transform.position);

        if (!mHasChangeCourseWidth && (achievement >= 0.5f))
        {
            mCourseManager.RequestChangeCourseWidth(CourseManager.CourseWidth * 0.8f);
            mHasChangeCourseWidth = true;
        }

        if (!mIsGoal)
        {
            mTime     += Time.deltaTime;
            mTimeLeft -= Time.deltaTime;
            if (mTimeLeft < 0.0f)
            {
                mTimeLeft = 0.0f;
            }
        }
        // mTextTime.text = mTime.ToString ("F2");
        mTextTime.text = mTimeLeft.ToString("F1");

        mTextStar.text = mStar.ToString();

        if (!mIsGoal && mCourseManager.CheckGoal(transform.position))
        {
            mIsGoal = true;
            // GameObject.Find ("TextGoal").GetComponent<Text> ().text = "GOAL!";

            mGameOverManager.GameOver(true, mCoursePartIndex, mStar, mTimeLeft);
            mStarManager.OnGameOver();
        }
    }