// Update is called once per frame void Update() { time += Time.deltaTime; //LifeCounter(); if (alive) { hud.WriteDeaths(); if (can_move) { Movement(); Mechanism(); } else { current_switch_time += Time.deltaTime; if (current_switch_time > time_switch) { audio_source.PlayOneShot(palanca); can_move = true; current_switch_time = 0.0f; } } CameraFollow(); Attachements(); } if (time > diversificador_tiempo && alive) { if (attached_object) { attached_object.GetComponent <BoxCollider2D>().enabled = true; } attached = false; attached_object = null; alive = false; if (animator) { animator.SetBool("is_dead", true); } if (hud != null) { hud.OnPlayerDeath(); } else { Debug.LogError("No existe HudScript"); } gameObject.layer = 11; game_controller.SpawnPlayer(); zoomIn(); } }