Exemplo n.º 1
0
    public void Refresh(PlayerController.PlayerStats statsToUse, Ability[] abilities)
    {
        //PlayerController.PlayerStats statsToUse = player.stats; //Get stats from player to use in UI
        if (statsToUse.player.isAlive)
        {
            ui.energyBar.fillAmount = Mathf.Clamp01(statsToUse.currentEnegy / statsToUse.maxEnergy);
            ui.energyText.text      = $"{statsToUse.currentEnegy.ToString("00.0")}/{statsToUse.maxEnergy.ToString("00.0")}";
            ui.healthBar.fillAmount = Mathf.Clamp01(statsToUse.hp / statsToUse.maxHp);
            ui.healthText.text      = $"{statsToUse.hp.ToString("00.0")}/{statsToUse.maxHp.ToString("00.0")}";

            for (int i = 0; i < abilities.Length; i++)
            {
                ui.abilityGridParent.GetChild(i).GetComponentInChildren <Image>().fillAmount = (Time.time - abilities[i].stats.timeAbilityLastUsed) / abilities[i].stats.cooldown;
            }

            ui.speedText.text = statsToUse.relativeLocalVelo.z.ToString();
        }
        else
        {
            ui.energyBar.fillAmount = 0;
            ui.energyText.text      = "0";
            ui.healthBar.fillAmount = 0;
            ui.healthText.text      = "0";
            ui.abilityGridParent.DeleteAllChildren();
            ui.speedText.text = "0";
            ui.speedEnergyCostThreshold.value = 0;
        }
    }
Exemplo n.º 2
0
 public void Refresh(PlayerController.PlayerStats statsToUse)
 {
     //PlayerController.PlayerStats statsToUse = player.stats; //Get stats from player to use in UI
     if (statsToUse.player.isAlive)
     {
         //Changes fill amount of EnergyBar Slider
         ui.energyBar.value = Mathf.Clamp01(statsToUse.currentEnegy / statsToUse.maxEnergy);
         ui.energyText.text = $"{statsToUse.currentEnegy.ToString("00.0")}/{statsToUse.maxEnergy.ToString("00.0")}";
         //Changes fill amount of HealthBar Slider
         ui.healthBar.value = Mathf.Clamp01(statsToUse.hp / statsToUse.maxEnergy);
         ui.healthText.text = $"{statsToUse.hp.ToString("00.0")}/{statsToUse.maxHp.ToString("00.0")}";
         //ui.abilityGridParent;
         ui.speedText.text         = statsToUse.relativeLocalVelo.z.ToString();
         ui.TurretImage.fillAmount = player.abilityManager.abilities[0].stats.chargePercentage;
         ui.BombImage.fillAmount   = player.abilityManager.abilities[1].stats.chargePercentage;
         ui.Speedometer.fillAmount = float.Parse(statsToUse.relativeLocalVelo.z.ToString()) / player.stats.maxSpeed; //Sets Raange of speedometer depending on maxSPeed vs currentSpeed
     }
     else
     {
         ui.energyBar.value = 0;
         ui.healthBar.value = 0;
         //ui.abilityGridParent;
         ui.speedText.text = "0";
         ui.speedEnergyCostThreshold.value = 0;
     }
 }
Exemplo n.º 3
0
 public void Refresh(PlayerController.PlayerStats statsToUse)
 {
     //PlayerController.PlayerStats statsToUse = player.stats; //Get stats from player to use in UI
     if (statsToUse.player.isAlive)
     {
         ui.energyBar.fillAmount = Mathf.Clamp01(statsToUse.currentEnegy / statsToUse.maxEnergy);
         ui.energyText.text      = $"{statsToUse.currentEnegy.ToString("00.0")}/{statsToUse.maxEnergy.ToString("00.0")}";
         ui.healthBar.fillAmount = Mathf.Clamp01(statsToUse.hp / statsToUse.maxEnergy);
         ui.healthText.text      = $"{statsToUse.hp.ToString("00.0")}/{statsToUse.maxHp.ToString("00.0")}";
         //ui.abilityGridParent;
         ui.speedText.text = statsToUse.relativeLocalVelo.z.ToString();
     }
     else
     {
         ui.energyBar.fillAmount = 0;
         ui.healthBar.fillAmount = 0;
         //ui.abilityGridParent;
         ui.speedText.text = "0";
         ui.speedEnergyCostThreshold.value = 0;
     }
 }