27 lines
381 B
C#
27 lines
381 B
C#
//Oliver
|
|
using UnityEngine.UI;
|
|
using UnityEngine;
|
|
|
|
public class Health : MonoBehaviour
|
|
{
|
|
public int maxHP = 100;
|
|
public int curHP;
|
|
void Start()
|
|
{
|
|
curHP = maxHP;
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
if(curHP <= 0)
|
|
{
|
|
die();
|
|
}
|
|
}
|
|
public void die()
|
|
{
|
|
Destroy(this);
|
|
}
|
|
}
|