Advertisement
Guest User

Untitled

a guest
Oct 21st, 2017
358
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.55 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5.  
  6. public class HP : MonoBehaviour {
  7.     public Text HPText;
  8.  
  9.     public float hp;
  10.     void Start () {
  11.         DisplayHP();
  12.     }
  13.  
  14.     public void Sleep() {
  15.         hp += 10;
  16.         DisplayHP();
  17.     }
  18.  
  19.     public void DisplayHP() {
  20.         HPText.text = hp.ToString("#");
  21.     }
  22.  
  23.     public void BeAttacked() {
  24.         hp -= 10.6f;
  25.         DisplayHP();
  26.         GameObject player = GameObject.FindGameObjectsWithTag("player");
  27.     }    
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement