public void refreshNumbers()
    {
        distance.text = "Distance: " + ObjectInSpace.distanceStr(owner.distanceInMeters(target)) + ", Velocity: " + target.getCurrentVelocityInMetersStr();

        if (target.getMaxShield() > 0f)
        {
            sliderShield.value    = target.getCurrentShield() / target.getMaxShield();
            sliderShieldText.text = "Shield: " + Mathf.Floor(target.getCurrentShield()) + "/" + target.getMaxShield();
            if (target.getShieldBalance() > 0)
            {
                sliderShieldText.text += " (<color=#008000ff>+" + target.getShieldBalance() + "</color>)";
            }
        }
        else
        {
            sliderShield.value    = 0f;
            sliderShieldText.text = "";
        }

        if (target.getMaxArmor() > 0f)
        {
            sliderArmor.value    = target.getCurrentArmor() / target.getMaxArmor();
            sliderArmorText.text = "Armor: " + Mathf.Floor(target.getCurrentArmor()) + "/" + target.getMaxArmor();
            if (target.getArmorBalance() > 0)
            {
                sliderArmorText.text += " (<color=#008000ff>+" + target.getArmorBalance() + "</color>)";
            }
        }
        else
        {
            sliderArmor.value    = 0f;
            sliderArmorText.text = "";
        }

        if (target.getMaxHull() > 0f)
        {
            sliderHull.value    = target.getCurrentHull() / target.getMaxHull();
            sliderHullText.text = "Hull: " + Mathf.Floor(target.getCurrentHull()) + "/" + target.getMaxHull();
            if (target.getHullBalance() > 0)
            {
                sliderHullText.text += " (<color=#008000ff>+" + target.getHullBalance() + "</color>)";
            }
        }
        else
        {
            sliderHull.value    = 0f;
            sliderHullText.text = "";
        }
    }
Example #2
0
    private void setValues()
    {
        valuesPrevious          = values;
        values                  = new Dictionary <string, float> ();
        values["shieldMax"]     = ship.getMaxShield();
        values["shieldCurrent"] = ship.getCurrentShield();
        values["shieldBalance"] = ship.getShieldBalance();

        values["armorMax"]     = ship.getMaxArmor();
        values["armorCurrent"] = ship.getCurrentArmor();
        values["armorBalance"] = ship.getArmorBalance();

        values["hullMax"]     = ship.getMaxHull();
        values["hullCurrent"] = ship.getCurrentHull();
        values["hullBalance"] = ship.getHullBalance();

        values["energyMax"]               = ship.getMaxEnergy();
        values["energyCurrent"]           = ship.getCurrentEnergy();
        values["energyProduction"]        = ship.getEnergyProduction();
        values["energyPassive"]           = ship.getEnergyDrainPassive();
        values["energyActive"]            = ship.getEnergyDrainActive();
        values["energyBalance"]           = values["energyProduction"] - values["energyPassive"] - values["energyActive"];
        values["energyActiveCoefficient"] = ship.getEnergyDrainActiveCoefficient();
        values["energyIsStable"]          = 0f;
        if (ship.isEnergyStable())
        {
            values["energyIsStable"] = 1f;
        }

        values["mass"]               = ship.getMass();
        values["drag"]               = ship.getDrag();
        values["velocityCurrent"]    = ship.getCurrentVelocity();
        values["velocityMax"]        = ship.getMaxVelocity();
        values["velocityMaxCurrent"] = ship.getMaxCurrentVelocity();
        values["engineThrust"]       = ship.getEngineThrust();
        values["maneuverability"]    = ship.getManeuverability();
        values["volume"]             = (float)ship.getVolume();
    }