public void UpdateValue(float value) { if (value != curHealthPercent) { curHealthPercent = value; var x = (1 - value) * maxHealthBarScale / 2; healthBar.Scale = new Vector3(value * maxHealthBarScale, healthBar.Scale.y); healthBar.Move(new Vector3(baseHealthX - x, healthBar.LocalPosition.y)); } }
void UpdateEnemyBar() { var percent = enemyHero.Stats.UltimateMeter.ValueAsPercent; float tipPos = percent * barLength; enemyTip.Move(new Vector2(tipPos, 0)); float centerPos = tipPos / 2; enemyBar.Move(new Vector2(centerPos, 0)); float barLen = 6 * (tipPos - enemyTip.Bounds.size.x / 2); enemyBar.Scale = new Vector2(barLen, 1); enemyText.text = enemyHero.Stats.Level.Value.ToString(); }