Advertisement
Guest User

Untitled

a guest
Dec 8th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.51 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5.  
  6. public class Health : MonoBehaviour
  7. {
  8.     private static float _health;
  9.     private static float maxHealth = 100f;
  10.     public Slider healthSlider;
  11.     void Start()
  12.     {
  13.         _health = maxHealth;
  14.         healthSlider.maxValue = maxHealth;
  15.         healthSlider.minValue = 0f;
  16.     }
  17.  
  18.     void Update()
  19.     {
  20.         _health = KnightCntrl.health;
  21.         healthSlider.value = _health;
  22.     }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement