Exemplo n.º 1
0
    void Update()
    {
        //gotta blow up the balloon first
        float timer = Time.deltaTime;

        if (sizeBlowUp != -1)
        {
            if (transform.localScale.x < sizeBlowUp)
            {
                float   blowUp     = timer * blowUpSpeed;
                Vector3 ballGrowBy = new Vector3(blowUp * 2.0f, blowUp * 2.0f, blowUp * 2.0f);
                transform.localScale += ballGrowBy;

                Vector3 ballMoveBy = new Vector3(0, blowUp, 0);
                transform.position += ballMoveBy;
            }
            else
            {
                if (!colorChange)
                {
                    GetComponent <Renderer>().material = originalMat;
                }

                float   deltaY       = timer * goUpSpeed;
                Vector3 deltaBallMov = new Vector3(0, deltaY, 0);
                transform.position += deltaBallMov;
            }

            if (transform.position.y >= 40)
            {
                if (!lostLife)
                {
                    lm.loseLife();
                }
                lostLife = true;
                Destroy(this.gameObject);
            }
        }



        //if it goes to far up
    }