Advertisement
Guest User

Untitled

a guest
Apr 18th, 2015
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.40 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using System.Collections;
  4.  
  5. public class PlayerInfo : MonoBehaviour {
  6.  
  7.     public float curHP = 100;
  8.     public float maxHP = 100;
  9.  
  10.     public Image HpImage;
  11.  
  12.     void Start()
  13.     {
  14.         HpImage.fillAmount = curHP / maxHP;
  15.     }
  16.  
  17.     public void CalculationHP()
  18.     {
  19.         curHP -= 5;
  20.         HpImage.fillAmount = curHP / maxHP;
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement