21 lines
417 B
C#
21 lines
417 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public abstract class hasHP: MonoBehaviour
|
|
{
|
|
public float MaxHP;
|
|
public float curHP;
|
|
|
|
private void Start() {
|
|
curHP = MaxHP;
|
|
}
|
|
public void damage(float d) {
|
|
curHP -= d;
|
|
if (curHP <= 0) {
|
|
Debug.Log(curHP);
|
|
this.die();
|
|
}
|
|
}
|
|
public abstract void die();
|
|
}
|