public Color ChangeSegmentColor(int index, float min, float max, Color c1, Color c2) { float colorChange = UtilScript.remapRange(index, min, max, 0, 1); Color lerpedColor = Color.LerpUnclamped(c1, c2, colorChange); return(lerpedColor); }
void Update() { float energyFill = UtilScript.remapRange(GameManager.energy, 0, 100, 0, 1); energyAmount.fillAmount = energyFill; float energyNum = GameManager.energy; energyText.text = energyNum.ToString(); }
void Update() { if (coolDown) { if (card != null) { card = GetComponentInChildren <Card> (); Image image = card.GetComponent <Image> (); image.fillMethod = Image.FillMethod.Horizontal; // image.fillMethod = Image.OriginHorizontal.Left; amountcoolDown = amountcoolDown + Time.deltaTime; float newCoolDownTime = Mathf.Clamp01(UtilScript.remapRange(amountcoolDown, 0, GameManager.cooldownTime, 0, 1)); image.fillAmount = newCoolDownTime; } } }
// Update is called once per frame void Update() { loadingTime = loader.loadTime; float newLoadingTime; if (buttonPressed) { amountLoaded = amountLoaded + Time.deltaTime; newLoadingTime = Mathf.Clamp01(UtilScript.remapRange(amountLoaded, 0, loadingTime, 0, 1)); image.fillAmount = newLoadingTime; // Debug.Log (newLoadingTime); if (newLoadingTime == 1) { buttonPressed = false; } } }