增加受击泛红效果

This commit is contained in:
2026-07-04 16:07:08 +08:00
parent d63f0c3fa7
commit fc585fa67e
6 changed files with 253 additions and 2 deletions
@@ -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)
{