public override void Tick() { var position = (_camera.transform.position - _bar.transform.position) * -1 + _barTransform.position; _barTransform.LookAt(position); _bar.UpdateBar(_attributeFloat.Percentage()); }
protected override void OnInitialize(GameHudModel model) { var attributesData = model.PlayerManager.PlayerActor.GetData <AttributesData>(); _healthProperty = attributesData.Attributes[Attribute.Health]; _healthProperty.PropertyChanged += HandleHealthChanged; _healthBar.material.SetFloat("_value", _healthProperty.Percentage()); _healthBarUpdate = StartCoroutine(UpdateHealthBar()); }
private void HandleHealthChanged(object sender, float value) { _healthBar.material.SetFloat("_value", _healthProperty.Percentage()); }