Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        GameObject nokia_3 = GameObject.Find("justinos_3");
        justin_3   n3      = nokia_3.GetComponent <justin_3> ();

        justin_3 = n3.xtypise;


        GameObject nokia_1 = GameObject.Find("justinos_2");
        justin_1   n1      = nokia_1.GetComponent <justin_1> ();

        justin_1 = n1.xtypise;

        GameObject nokia = GameObject.Find("justinos");
        justin     n     = nokia.GetComponent <justin> ();

        nok = n.xtypise;



        if (nok || justin_1 || justin_3)
        {
            DoShake();
        }

        if (ShakeIntensity > 0)
        {
            transform.position = OriginalPos + Random.insideUnitSphere * ShakeIntensity;
            transform.rotation = new Quaternion(OriginalRot.x + Random.Range(-ShakeIntensity, ShakeIntensity) * .2f,
                                                OriginalRot.y + Random.Range(-ShakeIntensity, ShakeIntensity) * .2f,
                                                OriginalRot.z + Random.Range(-ShakeIntensity, ShakeIntensity) * .0f,
                                                OriginalRot.w + Random.Range(-ShakeIntensity, ShakeIntensity) * .0f);

            ShakeIntensity -= ShakeDecay;
        }
        else if (Shaking)
        {
            Shaking = false;
        }
    }
    void Update()
    {
        Renderer rend  = glasses.GetComponent <Renderer>();
        Renderer rend2 = hat.GetComponent <Renderer>();

        if (using_glasses == 1)
        {
            rend.enabled = true;
        }
        else
        {
            rend.enabled = false;
        }
        if (using_hat == 1)
        {
            rend2.enabled = true;
        }
        else
        {
            rend2.enabled = false;
        }

        GameObject vel     = GameObject.Find("Da_instructions");
        Animator   velakia = vel.GetComponent <Animator> ();

        //	if(first_time == 0){

        if (velakia.GetCurrentAnimatorStateInfo(0).IsName("idle_instr") && !finished)
        {
            Time.timeScale = 0.0f;
            instruct       = true;
            velakia.Play("use_instruction");
        }
        if (Input.GetMouseButtonDown(0) && velakia.GetCurrentAnimatorStateInfo(0).IsName("use_instruction"))
        {
            velakia.Play("change");
        }
        if (Input.GetMouseButtonDown(0) && velakia.GetCurrentAnimatorStateInfo(0).IsName("change"))
        {
            velakia.Play("anywhere");
        }
        if (Input.GetMouseButtonDown(0) && velakia.GetCurrentAnimatorStateInfo(0).IsName("anywhere"))
        {
            velakia.Play("idle_instr");
            Time.timeScale = 1.0f;
            instruct       = false;
            finished       = true;
            first_time     = 1;
            PlayerPrefs.SetInt("ft", first_time);
        }
        //}


        energy = PlayerPrefs.GetInt("energy");

        energy_text.text = "" + energy;
        if (energy == 0)
        {
            Application.LoadLevel(0);
        }
        GameObject      skori   = GameObject.Find("Bro");
        movement_justin keimeno = skori.GetComponent <movement_justin> ();

        current_score = keimeno.Score;



        GameObject player_object = GameObject.Find("myAnimationBros 1");
        Vector3    player_pos_x  = player_object.transform.position;
        Vector3    temp          = player_object.transform.position;

        temp.x       = player_object.transform.position.x;
        player_pos_x = temp;

        if (player_pos_x.x > 98)
        {
            animator.Play("Thug_Life");
            erwthseis = true;
            GameObject girly   = GameObject.Find("home");
            Animator   girlish = girly.GetComponent <Animator> ();
            girlish.Play("mama_animation");
            mama = true;
        }

        GameObject nokia_3 = GameObject.Find("justinos_3");
        justin_3   n3      = nokia_3.GetComponent <justin_3> ();

        justin_3 = n3.just;


        GameObject nokia_1 = GameObject.Find("justinos_2");
        justin_1   n1      = nokia_1.GetComponent <justin_1> ();

        justin_1 = n1.just;

        GameObject nokia = GameObject.Find("justinos");
        justin     n     = nokia.GetComponent <justin> ();

        nok = n.just;

        sc1 = n1.score;
        sc2 = n.score;
        sc3 = n3.score;


        total       = sc1 + sc2 + sc3;
        Points.text = "Points = " + total;
        if (bieber)
        {
            animator.Play("bieber_hit");

            animator.SetTrigger("Idle");
            bieber = false;
        }
        GameObject   player         = GameObject.Find("ControlButtons");
        Touch_justin gateController = player.GetComponent <Touch_justin> ();

        mov = gateController.moving;

        GameObject destroyed     = GameObject.Find("justinos");
        justin     efage_bounidi = destroyed.GetComponent <justin> ();

        destr = efage_bounidi.destroyed;

        if (total > highscore_justin)
        {
            PlayerPrefs.SetInt("highscore_justin", total);
        }
        Total_Points_Justin = total;
        GameObject   change = GameObject.Find("Laserous");
        ChooseWeapon l      = change.GetComponent <ChooseWeapon>();

        changed = l.change_weapon;



        GameObject   da_laser = GameObject.Find("Laserous");
        ChooseWeapon laser    = da_laser.GetComponent <ChooseWeapon>();

        exei_laser = laser.using_laser;

        GameObject   using_punch = GameObject.Find("Laserous");
        ChooseWeapon bounia      = using_punch.GetComponent <ChooseWeapon>();

        bounidi = bounia.using_punch;

        if (Input.GetMouseButtonDown(0) && !mov && !nok && !changed && !pause && !thug_life && !instruct && !erwthseis)
        {
            if (bounidi)
            {
                animator.Play("myAnimationBros 1");
            }
            if (exei_laser)
            {
                animator.Play("Laserino");
            }

            animator.SetTrigger("Idle");
        }
        if (nok || justin_1 || justin_3)
        {
            bieber = true;
        }
    }