This commit is contained in:
CortexCore
2023-10-20 22:46:14 +08:00
parent a160813262
commit 325f63d6bc
42 changed files with 1602 additions and 79 deletions

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using BITFALL.Entities.Armor;
using BITFALL.Player.Equip;
using BITFALL.Player.Movement;
using UnityEngine;
@@ -34,6 +35,7 @@ namespace BITFALL.UX
[SerializeField] private UXBar healthBar;
[SerializeField] private UXBar lerpHealthBar;
[SerializeField] private UXBar staminaBar;
[SerializeField] private UXBar armorBar;
[Header(Constant.Header.Input)]
public InputActionReference inventoryAction;
@@ -50,6 +52,8 @@ namespace BITFALL.UX
private IEquipService _equipService;
[Inject]
private ISelector _selector;
[Inject]
private IArmor _armor;
private float _currentHealthLerp;
protected override void Awake()
{
@@ -99,6 +103,14 @@ namespace BITFALL.UX
_selector.OnInactive += OnInactive;
_selector.OnSelected += OnSelect;
_armor.OnArmorChanged += x => armorBar.Set(x);
_armor.OnEquipArmor += x =>
{
armorBar.Set(_armor.Armor);
armorBar.SetActive(true);
};
_armor.OnUnEquipArmor += x => armorBar.SetActive(false);
if (steamService.IsInitialized)
{
playerNameLabel.Set(steamService.Name);
@@ -108,6 +120,8 @@ namespace BITFALL.UX
_equipService = entity.Get<IEquipService>();
armorBar.SetActive(_armor.TryGetCurrentArmor(out _));
OnSetHP(_health.HealthPoint);
OnSetAlive(_health.IsAlive);