void Update() { GameObject nokiaa_3 = GameObject.Find("nokia_3"); nokia_3 n3 = nokiaa_3.GetComponent <nokia_3> (); nok_3 = n3.nokia; GameObject nokiaa_1 = GameObject.Find("nokia_1"); nokia_2 n1 = nokiaa_1.GetComponent <nokia_2> (); nok_1 = n1.nokia; GameObject nokia = GameObject.Find("nokia"); Nokia n = nokia.GetComponent <Nokia> (); nok = n.nokia; }
// Update is called once per frame void Update() { GameObject nokia_3 = GameObject.Find("nokia_3"); nokia_3 n3 = nokia_3.GetComponent <nokia_3> (); nok_3 = n3.nokia; GameObject nokiaa_1 = GameObject.Find("nokia_1"); nokia_2 n1 = nokiaa_1.GetComponent <nokia_2> (); nok_1 = n1.nokia; GameObject nokia = GameObject.Find("nokia"); Nokia n = nokia.GetComponent <Nokia> (); nok = n.nokia; if (nok || nok_1 || nok_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; } energy = PlayerPrefs.GetInt("energy"); energy_text.text = "" + energy; if (energy == 0) { Application.LoadLevel(0); } 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 > 168) { animator.Play("Thug_Life"); erwthseis = true; GameObject broly = GameObject.Find("bro_figure"); Animator broish = broly.GetComponent <Animator> (); broish.Play("happy_da_bro"); hapi = true; } // if (player_pos_x.x > 4) // { // GameObject nokiaz = GameObject.Find("Nokias"); // Vector3 scale = transform.localScale; // scale.x = 1.7f; // scale.y = 1.7f; // nokiaz.transform.localScale = scale; // } GameObject skori = GameObject.Find("Bro"); movement keimeno = skori.GetComponent <movement> (); current_score = keimeno.total; GameObject player = GameObject.Find("ControlButtons"); Touch gateController = player.GetComponent <Touch> (); mov = gateController.moving; if (sms) { GameObject.Find("Health Bar").GetComponent <HealthBar>().Damage(10); sms = false; } GameObject nokia_3 = GameObject.Find("nokia_3"); nokia_3 n3 = nokia_3.GetComponent <nokia_3> (); nok_3 = n3.nokia; GameObject nokiaa_1 = GameObject.Find("nokia_1"); nokia_2 n1 = nokiaa_1.GetComponent <nokia_2> (); nok_1 = n1.nokia; GameObject nokia = GameObject.Find("nokia"); Nokia n = nokia.GetComponent <Nokia> (); nok = n.nokia; sc1 = n1.score; sc2 = n.score; sc3 = n3.score; total = sc1 + sc2 + sc3; Points.text = "Points = " + total; if (total > highscore) { PlayerPrefs.SetInt("highscore", total); } Total_Points_Nokia = 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 (nok || nok_1 || nok_3) { GetComponent <Rigidbody2D>().AddForce(Vector2.left * 100f); Vector3 destination = new Vector3(0, 0, 30); transform.eulerAngles = Vector3.Lerp(transform.rotation.eulerAngles, destination, Time.deltaTime); animator.Play("almost_dead"); Almost_dead(); // gameObject.GetComponentInChildren<Renderer>().enabled = false; // animator.enabled = false; } if (Input.GetMouseButtonDown(0) && !pause && !mov && !nok && !nok_1 && !nok_3 && !sms && !changed && !thug_life && !erwthseis) { if (bounidi) { animator.Play("myAnimationBros 1"); } if (exei_laser) { animator.Play("Laserino"); } animator.SetTrigger("Idle"); } }