增加受击泛红效果
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using GameFramework;
|
||||
namespace IndianOceanAssets.Engine2_5D
|
||||
{
|
||||
// Handles health, damage, and death for entities
|
||||
public class HealthSystem : MonoBehaviour
|
||||
{
|
||||
/// <summary>玩家受伤时触发(用于受击特效等)</summary>
|
||||
public static Action onPlayerDamaged;
|
||||
|
||||
[Range(1, 100)]
|
||||
[SerializeField]
|
||||
private int maxHealth = 5; // Maximum health
|
||||
@@ -31,6 +35,10 @@ namespace IndianOceanAssets.Engine2_5D
|
||||
|
||||
health -= damageAmount;
|
||||
|
||||
// 玩家受伤时触发事件(用于受击泛红特效)
|
||||
if (isPlayer && onPlayerDamaged != null)
|
||||
onPlayerDamaged.Invoke();
|
||||
|
||||
// If dead
|
||||
if (health <= 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user