Files
zeling_v2/Assets/_Game/Scripts/Enemies/EnemyFeedback.cs
Joywayer 47bdc67cdf feat: Implement DownDash ability and related systems
- Added DownDash ability with cooldown and speed configuration.
- Introduced DownDashState to handle down dashing mechanics, including gravity manipulation and animation playback.
- Updated PlayerMovement to support DownDash functionality.
- Enhanced PlayerStats to manage spring charge consumption and healing.
- Modified PlayerCombat and WeaponHitBoxInstance to support new hit confirmation events.
- Updated AbilityType to include new form types for character abilities.
- Improved Gizmos for better visualization of enemy detection and attack ranges.
- Added feedback systems for form switching in PlayerFeedback and IFeedbackPlayer.
- Refactored combat and movement states to accommodate new abilities and ensure smooth transitions.
2026-05-22 00:09:50 +08:00

65 lines
2.5 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using UnityEngine;
using MoreMountains.Feedbacks;
using BaseGames.Combat;
using BaseGames.Feedback;
namespace BaseGames.Enemies
{
/// <summary>
/// 敌人反馈播放器:实现 IFeedbackPlayer将行为语义映射到 MMF_Player 实例。
/// 同时保留 OnHit/OnDeath 语义方法供 EnemyBase 直接调用(转发给接口方法)。
/// </summary>
public class EnemyFeedback : MonoBehaviour, IFeedbackPlayer
{
[Header("命中反馈")]
[SerializeField] private MMF_Player _onHitLight;
[SerializeField] private MMF_Player _onHitMedium;
[SerializeField] private MMF_Player _onHitHeavy;
[Header("受伤 / 死亡反馈")]
[SerializeField] private MMF_Player _onTakeHit;
[SerializeField] private MMF_Player _onDeath;
// ── IFeedbackPlayer ──────────────────────────────────────────────────────
public void PlayHit(HitWeight weight)
{
var player = weight switch
{
HitWeight.Light => _onHitLight,
HitWeight.Medium => _onHitMedium,
HitWeight.Heavy => _onHitHeavy,
_ => _onHitLight,
};
player?.PlayFeedbacks();
}
public void PlayTakeHit() => _onTakeHit?.PlayFeedbacks();
public void PlayDeath() => _onDeath?.PlayFeedbacks();
// 以下方法对敌人无意义,提供空实现保持接口完整
public void PlayParrySuccess() { }
public void PlayHeal() { }
public void PlayLandImpact() { }
public void PlayAttackWhoosh() { }
public void PlayJumpLaunch() { }
public void PlayFootstep() { }
public void TriggerPreset(string presetId) { }
public void PlaySFXById(string sfxId) { }
public void PlayFormSwitch(int formIndex) { } // 敌人无形态切换,空实现
// ── EnemyBase 语义方法 ────────────────────────────────────────────
/// <summary>受到伤害时调用(由 EnemyBase 触发)。</summary>
public void OnHit(DamageInfo info)
{
PlayTakeHit();
}
/// <summary>死亡时调用(由 EnemyBase 触发)。</summary>
public void OnDeath()
{
PlayDeath();
}
}
}