Beispiel #1
0
    void MoveAmmoBar()
    {
        float currentPos = CalculateFloatBar.Compute(CurrentAmmo, 0, MaxAmmo, NoAmmoPos, MaxAmmoPos);

        gaugeTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, currentPos, 670f);
        gaugeImage.color = new Color(1, CalculateFloatBar.Compute(CurrentAmmo, 0, MaxAmmo, 0, 1f), 0, 0.85f);
    }
Beispiel #2
0
    protected virtual void MoveBar()
    {
        float currentPos     = CalculateFloatBar.Compute(CurrentHealth, 0, MaxHealth, NoHealthPos, MaxHealthPos);
        Image healthBarImage = healthBarGauge.GetComponent <Image>();

        healthBarGauge.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, currentPos, 855f); //the last parameter is the width of the Rect the gauge is contained in.
        if ((0.5f * MaxHealth) <= CurrentHealth && CurrentHealth <= MaxHealth)
        {
            healthBarImage.color = new Color(CalculateFloatBar.Compute(CurrentHealth, 0.5f * MaxHealth, MaxHealth, 1f, 0), 1, 0, 0.75f);
        }
        if ((0.25f * MaxHealth) <= CurrentHealth && CurrentHealth < (0.5f * MaxHealth))
        {
            healthBarImage.color = new Color(1, CalculateFloatBar.Compute(CurrentHealth, 0.25f * MaxHealth, 0.5f * MaxHealth, 0, 1f), 0, 0.75f);
        }
    }
Beispiel #3
0
    protected override void MoveBar()
    {
        float currentPos = CalculateFloatBar.Compute(CurrentShield, 0, MaxShield, NoShieldPos, MaxShieldPos);

        shieldBarGauge.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, currentPos, 420f);
    }