Scriptum/Assets/Scripts/LevelBar.cs

46 lines
986 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class LevelBar : MonoBehaviour
{
public Slider slider;
public float maxExp;
public float exp;
public string maxExpString;
public string expString;
public Text displayText;
public void SetStartExp(float exp)
{
maxExp = PlayerPrefs.GetFloat("maxExp");
slider.maxValue = maxExp;
//slider.value = exp;
}
void Update()
{
maxExp = PlayerPrefs.GetFloat("maxExp");
exp = PlayerPrefs.GetFloat("exp");
slider.maxValue = maxExp;
slider.value = exp;
maxExpString = maxExp.ToString();
expString = exp.ToString();
displayText.text = expString + "/" + maxExpString;
//SetExp(exp);
}
/* public void SetExp(float exp)
{
slider.value = exp;
}
/* public void SetLevel()
{
}*/
}