using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class LightBar : MonoBehaviour{ public float maxTime; [HideInInspector] public float time; public Animator anim; float timeRest = 1; bool brujula; // Start is called before the first frame update void Start(){ time = maxTime; } // Update is called once per frame void Update(){ if (Input.GetButtonDown("Fire")){ if (brujula){ timeRest = 2; }else{ timeRest = 1; } } if (time > 0){ time = time - timeRest * Time.deltaTime; } if (time / maxTime < 0.75f){ anim.SetFloat("State", 2); } if (time / maxTime < 0.5f){ anim.SetFloat("State", 3); } if (time / maxTime < 0.25f){ anim.SetFloat("State", 4); } } }