init
This commit is contained in:
commit
862afc9b7a
478 changed files with 197737 additions and 0 deletions
21
Assets/Scripts/hasHP.cs
Normal file
21
Assets/Scripts/hasHP.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
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();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue