Exemple #1
0
    void Update()
    {
        Launched = rocketController.GetLaunched();

        if (Broken || Launched)
        {
            PumpAnimation.GetComponent <Animator>().SetBool("PumpStart", false);

            _bubbleController.StopBubble();
            return;
        }

        if (push)
        {
            Pumping();
            PumpAnimation.GetComponent <Animator>().SetBool("PumpStart", true);

            if (PumpMax > PumpPressure)
            {
                _bubbleController.StartBubble();
            }
            else
            {
                _bubbleController.StopBubble();
            }
        }
        else
        {
            PumpAnimation.GetComponent <Animator>().SetBool("PumpStart", false);

            _bubbleController.StopBubble();
        }

        if (BottolePressureMax < PumpPressure || Launched)   //破裂
        {
            ExplosionSound.PlayOneShot(ExplosionSound.clip);
            PumpPressure            = 0;
            Broken                  = true;
            rocketController.Broken = true;

            Instantiate(ExplisionPrefab, Rocket.transform.position, Rocket.transform.rotation);

            ScaleW.y = 0.0f;
            rocketController.Water.transform.localScale = ScaleW;

            Rocket.GetComponent <Rigidbody2D>().AddTorque(2.0f, ForceMode2D.Impulse);

            scoreData.ScoreNow = -10.0f;     //破裂したらマイナスポイント
            scoreData.SaveScore();

            StartCoroutine("GoScore");
        }
    }