Advertisement
RealiteeeyyyyTV

Untitled

Jan 12th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using UnityEngine.UI;
  4.  
  5. public class ExpSystem : MonoBehaviour {
  6.  
  7. public Slider expSlider;
  8. public int maxExp;
  9. public int startExp;
  10.  
  11. void Start ()
  12. {
  13. expSlider.maxValue = maxExp;
  14. expSlider.value = startExp;
  15. }
  16.  
  17. void OnTriggerEnter(Collider other)
  18. {
  19. if(other.tag == "Exp")
  20. {
  21. expSlider.value = expSlider.value + 50;
  22. }
  23.  
  24. if(expSlider.value = expSlider.maxValue)
  25. {
  26. expSlider.value = 0;
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement