33 lines
727 B
C#
33 lines
727 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class HealthBar : MonoBehaviour
|
|
{
|
|
public Slider slider;
|
|
public float maxHealth;
|
|
public float health;
|
|
|
|
public void SetMaxHealth(float health)
|
|
{
|
|
|
|
maxHealth = PlayerPrefs.GetFloat("maxHealth");
|
|
slider.maxValue = maxHealth;
|
|
}
|
|
|
|
//public void SetHealth(float health)
|
|
//{
|
|
// slider.value = health;
|
|
//}
|
|
|
|
void Update()
|
|
{
|
|
maxHealth = PlayerPrefs.GetFloat("maxHealth");
|
|
health = PlayerPrefs.GetFloat("health");
|
|
slider.maxValue = maxHealth;
|
|
slider.value = health;
|
|
//SetExp(exp);
|
|
}
|
|
}
|