34 lines
862 B
C#
34 lines
862 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class BossBar : MonoBehaviour
|
|
{
|
|
public Slider slider;
|
|
public float maxHealth;
|
|
public float health;
|
|
|
|
public Text displayText;
|
|
public float currentHealth;
|
|
public string maxHealthString;
|
|
public string currentHealthString;
|
|
|
|
//public void SetHealth(float health)
|
|
//{
|
|
// slider.value = health;
|
|
//}
|
|
|
|
void Update()
|
|
{
|
|
maxHealth = PlayerPrefs.GetFloat("WizardMaxHealth");
|
|
currentHealth = PlayerPrefs.GetFloat("WizardCurrentHealth");
|
|
slider.maxValue = maxHealth;
|
|
slider.value = currentHealth;
|
|
|
|
maxHealthString = maxHealth.ToString();
|
|
currentHealthString = currentHealth.ToString();
|
|
displayText.text = currentHealthString + "/" + maxHealthString;
|
|
}
|
|
}
|