private void UpdateFillAmount() { var t = Mathf.Clamp01(_currentValue / _maxValue); BarImage.fillAmount = t; // Update value text position and value ValueText.text = FloatStringCache.Get(_currentValue, 0); var y = BarImage.rectTransform.rect.yMin + BarImage.rectTransform.rect.height * t; ValueText.rectTransform.localPosition = new Vector3(ValueText.rectTransform.localPosition.x, y, ValueText.rectTransform.localPosition.z); }
private void ResetButtonColors() { // Set color of all buttons to white TRexButton.image.color = Color.white; AsteroidButton.image.color = Color.white; QuicksandButton.image.color = Color.white; ArmageddonButton.image.color = Color.white; TRexPrice.text = FloatStringCache.Get(GameManager.Instance.TRexManaCost, 0); AsteroidPrice.text = FloatStringCache.Get(GameManager.Instance.AsteroidManaCost, 0); QuicksandPrice.text = FloatStringCache.Get(GameManager.Instance.QuicksandManaCost, 0); ArmageddonPrice.text = FloatStringCache.Get(GameManager.Instance.ArmageddonManaCost, 0); }
public void Initialize() { BootsPickup.SetActive(Type == PickupType.Boots); WrenchPickup.SetActive(Type == PickupType.Wrench); ShieldPickup.SetActive(Type == PickupType.Shield); switch (Type) { case PickupType.Boots: Cost = BootsCost; break; case PickupType.Wrench: Cost = WrenchCost; break; case PickupType.Shield: Cost = ShieldCost; break; } PriceText.text = FloatStringCache.Get(Cost, 0); }