mycj_demo/mycj/Assets/Script/npcInfo.cs
2024-12-02 09:37:47 +08:00

27 lines
521 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class npcInfo : MonoBehaviour
{
[Header("HpĬÈÏΪ100")]
public float Hp=100;
public void ChangeHp(float number)
{
if ((this.Hp+ number) <=0)
{
PlayerInfo.instance.ChangeGold(10);
Destroy(this.gameObject);
return;
}
Debug.Log("¸Ä±äѪÁ¿");
this.Hp += number;
}
public void ClearNpc()
{
Destroy(this.gameObject);
}
}