2024-12-04 15:05:38 +08:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
2024-12-06 15:15:30 +08:00
|
|
|
|
using System.Threading.Tasks;
|
2024-12-04 15:05:38 +08:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
public class PlayerState : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
|
2024-12-06 15:15:30 +08:00
|
|
|
|
|
|
|
|
|
|
2024-12-04 15:05:38 +08:00
|
|
|
|
[Header("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѫ<EFBFBD><D1AA>")]
|
2024-12-04 16:40:48 +08:00
|
|
|
|
public float totalHp = 100;
|
2024-12-04 15:05:38 +08:00
|
|
|
|
[Header("<22><><EFBFBD>ҵ<EFBFBD>ǰѪ<C7B0><D1AA>")]
|
|
|
|
|
public float currentHp;
|
|
|
|
|
[Header("<22>ֿ<EFBFBD><D6BF><EFBFBD>")]
|
|
|
|
|
public float defend;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Start is called before the first frame update
|
|
|
|
|
void Start()
|
|
|
|
|
{
|
2024-12-04 16:40:48 +08:00
|
|
|
|
currentHp = totalHp;
|
2024-12-04 15:05:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
|
void Update()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-04 16:40:48 +08:00
|
|
|
|
public void beHurt(float hurt)
|
2024-12-04 15:05:38 +08:00
|
|
|
|
{
|
2024-12-05 09:21:07 +08:00
|
|
|
|
if(currentHp >0)
|
|
|
|
|
{
|
|
|
|
|
currentHp -= hurt;
|
|
|
|
|
Debug.Log(currentHp);
|
2024-12-06 15:15:30 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD>
|
|
|
|
|
ScreenRed.instance.ShowRed();
|
2024-12-05 09:21:07 +08:00
|
|
|
|
}
|
2024-12-04 15:05:38 +08:00
|
|
|
|
if(currentHp <= 0)
|
|
|
|
|
{
|
|
|
|
|
Debug.Log("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-06 15:15:30 +08:00
|
|
|
|
|
2024-12-04 15:05:38 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|