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

20 lines
470 B
C#
Raw Normal View History

2019-04-28 14:41:28 +02:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class FillAmountFromPlayerHP : MonoBehaviour
{
2019-04-28 16:34:50 +02:00
private EntityPlayer player;
2019-04-28 14:41:28 +02:00
private Image image;
private void Start() {
2019-04-28 16:34:50 +02:00
player = GameObject.FindGameObjectWithTag("Player").GetComponent<EntityPlayer>();
2019-04-28 14:41:28 +02:00
image = GetComponent<Image>();
}
private void Update() {
image.fillAmount = player.hp / player.hpMax;
}
}