Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using UnityEngine.UI;
- public class LifeManager : MonoBehaviour {
- public int startingLives;
- private int lifeCounter;
- private Text theText;
- // Use this for initialization
- void Start () {
- theText = GetComponent<Text>();
- lifeCounter = startingLives;
- }
- // Update is called once per frame
- void Update () {
- theText.text = "x " + lifeCounter;
- }
- public void GiveLife()
- {
- lifeCounter++;
- }
- public void Takelife()
- {
- lifeCounter--;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment