Example #1
0
    public void Refresh()
    {
        PopulationText.text = spawnableObject.name + spawnableObject.Population.ToString(" [0]");

        if (spawnableObject.Population == 0f)
        {
            PopulationBar.SetNonSlerpValue(0f);
        }
        else
        {
            PopulationBar.SetNonSlerpValue(spawnableObject.Population / spawnableObject.MaxPopulation);
        }

        ConsumptionText.text  = "Consumption: ";
        ConsumptionText.text += spawnableObject.TotalConsumptionOfMe > spawnableObject.Population ? "<color=red>" : "<color=green>";
        ConsumptionText.text += spawnableObject.TotalConsumptionOfMe.ToString("0");
    }
Example #2
0
    void UpdateEnergy()
    {
        EnergyText.text = "Energy: " + Energy.ToString("0") + "/" + MaxEnergy.ToString("0");
        float energyScale = Energy / MaxEnergy;

        EnergySlerper.SetNonSlerpValue(energyScale);
        //EnergySlerper.SetTargetScale(energyScale);
    }