Scriptum/Assets/Scripts/LevelBar.cs

46 lines
986 B
C#
Raw Permalink Normal View History

2022-10-23 00:21:54 +02:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class LevelBar : MonoBehaviour
{
public Slider slider;
2022-10-23 13:29:22 +02:00
public float maxExp;
public float exp;
2022-12-18 19:19:57 +01:00
public string maxExpString;
public string expString;
public Text displayText;
2022-10-23 00:21:54 +02:00
public void SetStartExp(float exp)
{
2022-10-23 13:29:22 +02:00
maxExp = PlayerPrefs.GetFloat("maxExp");
slider.maxValue = maxExp;
2022-10-23 00:21:54 +02:00
//slider.value = exp;
}
2022-10-23 13:29:22 +02:00
void Update()
{
maxExp = PlayerPrefs.GetFloat("maxExp");
exp = PlayerPrefs.GetFloat("exp");
slider.maxValue = maxExp;
slider.value = exp;
2022-12-18 19:19:57 +01:00
2022-12-18 19:19:57 +01:00
maxExpString = maxExp.ToString();
expString = exp.ToString();
displayText.text = expString + "/" + maxExpString;
2022-10-23 13:29:22 +02:00
//SetExp(exp);
}
/* public void SetExp(float exp)
2022-10-23 00:21:54 +02:00
{
slider.value = exp;
}
/* public void SetLevel()
{
}*/
}