_xiaofang/xiaofang/Assets/Script/hylScripts/PlayerState.cs
2024-12-06 15:15:30 +08:00

50 lines
833 B
C#

using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
public class PlayerState : MonoBehaviour
{
[Header("玩家总血量")]
public float totalHp = 100;
[Header("玩家当前血量")]
public float currentHp;
[Header("抵抗力")]
public float defend;
// Start is called before the first frame update
void Start()
{
currentHp = totalHp;
}
// Update is called once per frame
void Update()
{
}
public void beHurt(float hurt)
{
if(currentHp >0)
{
currentHp -= hurt;
Debug.Log(currentHp);
//这里加上屏幕闪红
ScreenRed.instance.ShowRed();
}
if(currentHp <= 0)
{
Debug.Log("你死了");
}
}
}