示例#1
0
    void Update()
    {
        rigidbody2D.velocity = new Vector2(0f, rigidbody2D.velocity.y);
        if (Application.loadedLevelName != "TitleTop")
        {
            if (!gameover)
            {
                if (Input.GetKeyDown(KeyCode.Space) || Input.GetMouseButtonDown(0))
                {
                    touchCount += 1;
                    if (touchCount == 1)
                    {
                        createObject.startCreatePipes();
                        birdSelectController.changeBirdAnimation();
                    }
                    mainGamePlayFlg         = true;
                    fadeFlg                 = true;
                    rigidbody2D.isKinematic = false;
                    didFlap                 = true;
                    wingSound.Play();
                }
            }

            if (moveResultFlg)
            {
                if (result.transform.position.y >= 2.3f)
                {
                    StartCoroutine("playResultMoveSount");
                    result.rigidbody2D.AddForce(Vector2.zero);
                    result.rigidbody2D.isKinematic = true;
                    result.transform.position      = new Vector3(0.7f, 2.428f, -3f);
                    moveResultFlg = false;
                    resultScoreCon.StartCoroutine("countUp", score);
                    medalController.StartCoroutine("startApperMedal", score);
                }
                else
                {
                    if (startMoveResult)
                    {
//												Vector3 vec = result.transform.position;
//												vec.y += 7f * Time.deltaTime;
//												result.transform.position = vec;
                        result.rigidbody2D.isKinematic = false;
                        result.rigidbody2D.AddForce(Vector2.up * 30);
                    }
                    else
                    {
                        StartCoroutine("moveResult");
                    }
                }
            }
        }

        if (fadeFlg)
        {
            currentRemainTime -= Time.deltaTime;
            float alpha = currentRemainTime / fadeTime;
            getReady.color    = new Color(255, 255, 255, alpha);
            explanation.color = new Color(255, 255, 255, alpha);
        }
    }