From 45ab7dae9930c2ee227575bf0be1263bd08c81cd Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期二, 02 十二月 2025 10:14:46 +0800
Subject: [PATCH] 125 战斗 语音加速相关

---
 Main/System/Battle/BattleObject/BattleObject.cs |    2 +-
 Main/System/Battle/Skill/SkillBase.cs           |    4 ++--
 Main/System/Battle/Sound/BattleSoundManager.cs  |   47 +++++++++++++----------------------------------
 3 files changed, 16 insertions(+), 37 deletions(-)

diff --git a/Main/System/Battle/BattleObject/BattleObject.cs b/Main/System/Battle/BattleObject/BattleObject.cs
index d0a4b6e..27c700b 100644
--- a/Main/System/Battle/BattleObject/BattleObject.cs
+++ b/Main/System/Battle/BattleObject/BattleObject.cs
@@ -439,7 +439,7 @@
     public virtual void OnDeath(Action _onDeathAnimationComplete)
     {
         buffMgr.RemoveAllBuff();
-        battleField.soundManager.PlayEffectSound(teamHero.heroConfig.DeathSFX);
+        battleField.soundManager.PlayEffectSound(teamHero.heroConfig.DeathSFX, false);
         motionBase.PlayDeadAnimation(() =>
         {
             teamHero.isDead = true;
diff --git a/Main/System/Battle/Skill/SkillBase.cs b/Main/System/Battle/Skill/SkillBase.cs
index 5daed2b..46d265e 100644
--- a/Main/System/Battle/Skill/SkillBase.cs
+++ b/Main/System/Battle/Skill/SkillBase.cs
@@ -237,7 +237,7 @@
 
         if (skillConfig.SkinllSFX1 != 0)
         {
-            battleField.soundManager.PlayEffectSound(skillConfig.SkinllSFX1);
+            battleField.soundManager.PlayEffectSound(skillConfig.SkinllSFX1, false);
         }
 
         if (caster != null)
@@ -370,7 +370,7 @@
         {
             if (skillConfig.CastDistance < 9999 && skillConfig.SkinllSFX2 != 0)
             {
-                battleField.soundManager.PlayEffectSound(skillConfig.SkinllSFX2);
+                battleField.soundManager.PlayEffectSound(skillConfig.SkinllSFX2, false);
             }
 
             TurnBack(() =>
diff --git a/Main/System/Battle/Sound/BattleSoundManager.cs b/Main/System/Battle/Sound/BattleSoundManager.cs
index 1483615..7653235 100644
--- a/Main/System/Battle/Sound/BattleSoundManager.cs
+++ b/Main/System/Battle/Sound/BattleSoundManager.cs
@@ -73,54 +73,25 @@
         CleanupFinishedAudioSources();
     }
     
-    /// <summary>
-    /// 棰勭儹闊抽锛堟殏鏃朵负绌猴紝鐣欑粰绉诲姩绔紭鍖栵級
-    /// </summary>
-    public void PrewarmAudio(params int[] audioIds)
-    {
-        // TODO: 绉诲姩绔紭鍖栨椂瀹炵幇
-    }
-    
-    /// <summary>
-    /// 棰勭儹闊抽锛堟殏鏃朵负绌猴紝鐣欑粰绉诲姩绔紭鍖栵級
-    /// </summary>
-    public void PrewarmAudio(List<int> audioIds)
-    {
-        // TODO: 绉诲姩绔紭鍖栨椂瀹炵幇
-    }
-    
-    /// <summary>
-    /// 鎾斁鎶�鑳介煶鏁�
-    /// </summary>
-    /// <param name="audioId">闊虫晥ID</param>
-    public void PlaySkillSound(int audioId)
-    {
-        if (audioId <= 0)
-        {
-            return;
-        }
-        
-        PlaySound(audioId);
-    }
     
     /// <summary>
     /// 鎾斁鐗规晥闊虫晥
     /// </summary>
     /// <param name="audioId">闊虫晥ID</param>
-    public void PlayEffectSound(int audioId)
+    public void PlayEffectSound(int audioId, bool pitchControl = true)
     {
         if (audioId <= 0)
         {
             return;
         }
         
-        PlaySound(audioId);
+        PlaySound(audioId, pitchControl);
     }
     
     /// <summary>
     /// 鏍稿績鎾斁鏂规硶
     /// </summary>
-    private void PlaySound(int audioId)
+    private void PlaySound(int audioId, bool pitchControl)
     {
         // 妫�鏌ユ槸鍚︽湁鐒︾偣锛屾棤鐒︾偣鏃朵笉鎾斁
         if (!hasFocus)
@@ -152,8 +123,16 @@
         
         // 璁剧疆鎾斁閫熷害锛屼娇鐢╬itch鏉ユ帶鍒�
         // pitch鑼冨洿寤鸿鍦�0.5-2.0涔嬮棿浠ラ伩鍏嶅け鐪�
-        float pitch = Mathf.Clamp(currentSpeedRatio, 0.5f, 2.0f);
-        source.pitch = pitch;
+        if (pitchControl)
+        {
+            float pitch = Mathf.Clamp(currentSpeedRatio, 0.5f, 2.0f);
+            source.pitch = pitch;
+        }
+        else
+        {
+            source.pitch = 1.0f;
+        }
+
         
         // 鎾斁闊虫晥
         source.PlayOneShot(audioClip);

--
Gitblit v1.8.0