Initial Commit

This commit is contained in:
2026-04-01 15:46:15 +01:00
commit 72ae178fd1
12270 changed files with 3639153 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
using UnityEngine;
using UnityEngine.UI;
public class Building : MonoBehaviour
{
public float maxHealth;
private float curHealth;
private Slider healthBar;
void Awake()
{
healthBar = GetComponentInChildren<Slider>();
}
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
curHealth = maxHealth;
healthBar.maxValue = maxHealth;
healthBar.value = curHealth;
}
// Update is called once per frame
void Update()
{
}
public void TakeDamage(float damageToTake)
{
curHealth -= damageToTake;
if(curHealth <= 0)
gameObject.SetActive(false);
healthBar.value = curHealth;
}
public float GetHealth()
{
return curHealth;
}
}