Пример #1
0
    // Update is called once per frame

    void Update()
    {
        score    = Mathf.Max(score, ScoreBody.transform.position.y);
        SpeedMax = Mathf.Max(SpeedMax, ScoreBody.velocity.y);

        scoreLabel.text = ScoreBody.transform.position.y.ToString("N2");
        SpeedMeter.text = ScoreBody.velocity.y.ToString("N1");


        if (score > RocketBody2D.transform.position.y + 2.0f)   // 頂点に達したら(2m落ちたら)
        {
            if (!TopFlag)

            {
                ScoreData.CalcNewScore(score);
                TopFlag = true;

                //RocketBody2D.centerOfMass = center;
                StartCoroutine("Rotate");
                ScoreData.ScoreNow = score;
                ScoreData.CalcMaxDistance(score);
                ScoreData.SaveScore();
            }

            if (ScoreBody.transform.position.y <= 1.0f && ScoreBody.velocity.y <= 0.5f && !Landed)
            {
                //Debug.Log("Stop");
                StartCoroutine("GoScore");

                Landed = true;
            }
        }
    }