i3e-asg2/Assets/Scripts/Healthbar.cs

21 lines
416 B
C#
Raw Normal View History

2024-07-05 01:22:55 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Healthbar : MonoBehaviour
{
public Slider slider;
void Start()
{
slider.maxValue = GameManager.instance.playerHealth;
slider.value = GameManager.instance.playerHealth;
}
public void Update()
{
slider.value = GameManager.instance.playerHealth;
}
}