Guest User

Untitled

a guest
Jun 8th, 2015
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using UnityEngine.UI;
  4.  
  5. public class LifeManager : MonoBehaviour {
  6.  
  7. public int startingLives;
  8. private int lifeCounter;
  9.  
  10. private Text theText;
  11.  
  12. // Use this for initialization
  13. void Start () {
  14. theText = GetComponent<Text>();
  15.  
  16. lifeCounter = startingLives;
  17. }
  18.  
  19. // Update is called once per frame
  20. void Update () {
  21. theText.text = "x " + lifeCounter;
  22. }
  23.  
  24. public void GiveLife()
  25. {
  26. lifeCounter++;
  27. }
  28.  
  29. public void Takelife()
  30. {
  31. lifeCounter--;
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment