feat(): 大量更新
This commit is contained in:
32
Assets/Script/UI/PlayerHpViewer.cs
Normal file
32
Assets/Script/UI/PlayerHpViewer.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using Core;
|
||||
using Gameplay.Player;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class PlayerHpViewer : UIBase
|
||||
{
|
||||
private PlayerController _playerController;
|
||||
public Text hpText;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
UIViewerControllerLocator.Instance.TryGetWait<PlayerController>(OnGet);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (_playerController != null)
|
||||
{
|
||||
hpText.text = "HP: " + _playerController.CurrentHealth;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnGet(PlayerController playerController)
|
||||
{
|
||||
_playerController = playerController;
|
||||
}
|
||||
}
|
||||
}
|
3
Assets/Script/UI/PlayerHpViewer.cs.meta
Normal file
3
Assets/Script/UI/PlayerHpViewer.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a450025fc367419faaf7481787bfac88
|
||||
timeCreated: 1760514338
|
@@ -2,9 +2,8 @@
|
||||
"name": "UI",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:ec826b79cbc40da479bcc7969404880e",
|
||||
"GUID:fd0e97c21c15497f9406b8ee23c1f67e",
|
||||
"GUID:9e4105fe56ff4b1789a1683a3c08d507"
|
||||
"GUID:ceb6a2c14699464ca35be17af198f904"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
Reference in New Issue
Block a user