Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using UnityEngine.UI;
- public class ExpSystem : MonoBehaviour {
- public Slider expSlider;
- public int maxExp;
- public int startExp;
- void Start ()
- {
- expSlider.maxValue = maxExp;
- expSlider.value = startExp;
- }
- void OnTriggerEnter(Collider other)
- {
- if(other.tag == "Exp")
- {
- expSlider.value = expSlider.value + 50;
- }
- if(expSlider.value = expSlider.maxValue)
- {
- expSlider.value = 0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement