mycj_demo/mycj/Assets/Script/npcInfo.cs

27 lines
521 B
C#
Raw Normal View History

2024-12-02 09:37:47 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class npcInfo : MonoBehaviour
{
[Header("HpĬ<70><C4AC>Ϊ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("<22>ı<EFBFBD>Ѫ<EFBFBD><D1AA>");
this.Hp += number;
}
public void ClearNpc()
{
Destroy(this.gameObject);
}
}