Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class HP : MonoBehaviour {
- public Text HPText;
- public float hp;
- void Start () {
- DisplayHP();
- }
- public void Sleep() {
- hp += 10;
- DisplayHP();
- }
- public void DisplayHP() {
- HPText.text = hp.ToString("#");
- }
- public void BeAttacked() {
- hp -= 10.6f;
- DisplayHP();
- GameObject player = GameObject.FindGameObjectsWithTag("player");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement