// Update is called once per frame void Update() { //if timer is enabled, show the timer if (GameControl.EnableTimer()) { float remainingDuration = GameControl.GetRemainingDuration(); if (remainingDuration > 0) { //float duration=objective.survivalDuration; //int minO=(int)Mathf.Floor(duration/60); //int secO=(int)Mathf.Floor(duration%60); int minR = (int)Mathf.Floor(remainingDuration / 60); int secR = (int)Mathf.Floor(remainingDuration % 60); lbTimer.text = "Time Left: " + minR + ":" + (secR > 9 ? secR.ToString() : "0" + secR); } else { lbTimer.text = "Time Left: 0:00"; } } else { lbTimer.text = ""; } lbRespawnCount.text = GameControl.GetPlayerLife().ToString(); UnitPlayer player = GameControl.GetPlayer(); if (player == null) { lbHP.text = "0/" + player.GetFullHitPoint(); //barHP.sizeDelta=new Vector2(-barHPLength, 0); sliderHPBar.value = 0; return; } //sliderHitPointBar.value=player.hitPoint/player.hitPointFull; //sliderEnergyBar.value=player.energy/player.energyFull; sliderHPBar.value = player.hitPoint / player.GetFullHitPoint(); lbHP.text = Mathf.Round(player.hitPoint) + "/" + Mathf.Round(player.GetFullHitPoint()); //barHP.sizeDelta=new Vector2((1-(player.hitPoint/player.GetFullHitPoint()))*-barHPLength, 0); sliderEnergyBar.value = player.energy / player.GetFullEnergy(); lbEnergy.text = Mathf.Round(player.energy) + "/" + Mathf.Round(player.GetFullEnergy()); //barEnergy.sizeDelta=new Vector2((1-(player.energy/player.GetFullEnergy()))*-barEnergyLength, 0); if (playerProgress != null) { sliderExpBar.value = Mathf.Max(0.01f, playerProgress.GetCurrentLevelProgress()); } if (!reloading) { if (!player.UseEnergyAsAmmo()) { string clip = player.GetCurrentClip() < 0 ? "∞" : player.GetCurrentClip().ToString(); string ammo = player.GetAmmo() < 0 ? "∞" : player.GetAmmo().ToString(); uiButtonWeapon.labelAlt.text = clip + "/" + ammo; } else { uiButtonWeapon.labelAlt.text = "Use Energy"; } } if (GameControl.EnableAltFire()) { Ability ability = player.GetWeaponAbility(); if (ability != null) { uiButtonAltFire.label.text = ability.currentCD <= 0 ? "" : ability.currentCD.ToString("f1") + "s"; uiButtonAltFire.button.interactable = ability.IsReady() == "" ? true : false; } } int creditTgt = GameControl.GetCredits(); if (credit != creditTgt) { updateSpeed = Mathf.Max(minUpdateSpeed, Mathf.Abs(1f / (float)(creditTgt - credit))); credit = (int)Mathf.Round(Mathf.Lerp(credit, creditTgt, updateSpeed)); } int scoreTgt = GameControl.GetScore(); if (score != scoreTgt) { updateSpeed = Mathf.Max(minUpdateSpeed, Mathf.Abs(1f / (float)(scoreTgt - score))); score = (int)Mathf.Round(Mathf.Lerp(score, scoreTgt, updateSpeed)); } //lbCredit.text=""; //lbCredit.text="Credits: "+(credit<0 ? "-" : "")+"$"+Mathf.Abs(credit); lbScore.text = "Score: " + score; }