Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Gamehandler : MonoBehaviour
- {
- [SerializeField] private HealthBar healthBar;
- // Start is called before the first frame update
- private void Start()
- {
- //healthBar.SetSize(0.5f);
- }
- public void lowerHealth(float sizeNormalized)
- {
- float amount = sizeNormalized;
- float current = healthBar.getSize();
- float health = current - amount;
- if (current <= 0)
- {
- }
- else
- {
- healthBar.SetSize(health);
- }
- }
- void Update()
- {
- // Hans tot ?
- if (healthBar.getSize() <= 0) {
- GameObject Hans = GameObject.FindWithTag("Hans");
- Hans.GetComponent<Renderer>().enabled = false;
- Transform Healthbar = transform.Find("Baum");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement