- 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.
65 lines
2.5 KiB
C#
65 lines
2.5 KiB
C#
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();
|
||
}
|
||
}
|
||
}
|
||
|