1
Fork 0
slime-blood-and-pain/Assets/Scripts/TextFromPlayerHP.cs

26 lines
590 B
C#
Raw Normal View History

2019-04-29 19:45:54 +00:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class TextFromPlayerHP : MonoBehaviour
{
private EntityPlayer player;
private Text text;
public bool max;
private void Start() {
player = GameObject.FindGameObjectWithTag("Player").GetComponent<EntityPlayer>();
text = GetComponent<Text>();
}
private void Update() {
if(max) {
text.text = "/ " + player.hpMax.ToString("0.0");
}
else {
text.text = player.hp.ToString("0.0");
}
}
}