SHARE
TWEET

Untitled

a guest Sep 20th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class Gamehandler : MonoBehaviour
  6. {
  7.     [SerializeField] private HealthBar healthBar;
  8.  
  9.     // Start is called before the first frame update
  10.     private void Start()
  11.     {
  12.         //healthBar.SetSize(0.5f);
  13.     }
  14.  
  15.     public void lowerHealth(float sizeNormalized)
  16.     {
  17.         float amount = sizeNormalized;
  18.  
  19.         float current = healthBar.getSize();
  20.  
  21.         float health = current - amount;
  22.  
  23.         if (current <= 0)
  24.         {
  25.  
  26.         }
  27.         else
  28.         {
  29.             healthBar.SetSize(health);
  30.  
  31.         }
  32.  
  33.        
  34.     }
  35.  
  36.     void Update()
  37.     {
  38.         // Hans tot ?
  39.         if (healthBar.getSize() <= 0) {
  40.             GameObject Hans = GameObject.FindWithTag("Hans");
  41.             Hans.GetComponent<Renderer>().enabled = false;
  42.             Transform Healthbar = transform.Find("Baum");
  43.         }
  44.     }
  45.  
  46. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top