Merge branch 'develop' into feature/czq_0617
This commit is contained in:
@@ -19,7 +19,7 @@ position: 205,199
|
||||
|
||||
//【流程相关】
|
||||
//gamestage:1-引入对话;2-检查;3-检查后对话;4-调速;5-调速后对话(冷却液)
|
||||
<<declare $gameStage=1>>
|
||||
<<declare $gameStage=2>>
|
||||
<<declare $emoChecked=false>>
|
||||
<<declare $logicChecked=false>>
|
||||
<<declare $memoryChecked=false>>
|
||||
|
||||
+821
-801
File diff suppressed because it is too large
Load Diff
@@ -4,6 +4,7 @@ using Newtonsoft.Json;
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using DG.Tweening;
|
||||
using AibisDream.Kit;
|
||||
|
||||
namespace AibisDream.FixSystem
|
||||
{
|
||||
@@ -218,6 +219,16 @@ namespace AibisDream.FixSystem
|
||||
bool shouldShow = UnityEngine.Random.value > 0.5f;
|
||||
SetCutTextVisible(shouldShow);
|
||||
|
||||
// 播放相应的音效
|
||||
if (shouldShow)
|
||||
{
|
||||
AudioManager.Instance.PlaySfx("event:/ActionFB/light_flicker_on");
|
||||
}
|
||||
else
|
||||
{
|
||||
AudioManager.Instance.PlaySfx("event:/ActionFB/light_flicker_off");
|
||||
}
|
||||
|
||||
// 随机等待时间,模拟接触不良效果
|
||||
float waitTime = UnityEngine.Random.Range(cutTextFlickerInterval * 0.5f, cutTextFlickerInterval * 1.5f);
|
||||
yield return new WaitForSeconds(waitTime);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using UnityEngine;
|
||||
using DG.Tweening;
|
||||
using AibisDream.Kit;
|
||||
|
||||
namespace AibisDream.FixSystem
|
||||
{
|
||||
@@ -125,6 +126,8 @@ namespace AibisDream.FixSystem
|
||||
PlugRef.PullUpSocket();
|
||||
BodyModuleSystem.CloseModuleSlots(null);
|
||||
PlugRef.ReturnToStartPosition();
|
||||
AudioManager.Instance.PlaySfx("event:/ActionFB/mods_close");
|
||||
AudioManager.Instance.PlaySfx("event:/FollowInput/plugdrop");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -4,6 +4,7 @@ using Cinemachine;
|
||||
using AibisDream.Framework;
|
||||
using DG.Tweening;
|
||||
using System.Collections;
|
||||
using AibisDream.Kit;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
@@ -81,6 +82,7 @@ namespace AibisDream
|
||||
|
||||
private void ActivateGear()
|
||||
{
|
||||
AudioManager.Instance.PlaySfx("event:/FollowInput/drill");
|
||||
isGearActive = true;
|
||||
if (gearFollower != null)
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@ using DG.Tweening;
|
||||
using AibisDream.FixSystem;
|
||||
using AibisDream; // 添加OpenSystem的命名空间
|
||||
using System.Collections;
|
||||
using AibisDream.Kit;
|
||||
|
||||
public class GearFollower : MonoBehaviour
|
||||
{
|
||||
@@ -61,7 +62,7 @@ public class GearFollower : MonoBehaviour
|
||||
private Quaternion originalTargetRotation;
|
||||
private Vector3 originalTargetScale;
|
||||
private AudioSource audioSource;
|
||||
private Sequence cutCompleteSequence; // DOTween序列
|
||||
private DG.Tweening.Sequence cutCompleteSequence; // DOTween序列
|
||||
private HashSet<int> cutEdgeIndices = new HashSet<int>(); // 记录已切割的边缘点索引
|
||||
|
||||
private float currentEmissionRate = 0f;
|
||||
@@ -92,6 +93,7 @@ public class GearFollower : MonoBehaviour
|
||||
private Vector3 shakeOffset = Vector3.zero;
|
||||
private Vector3 targetPosition = Vector3.zero;
|
||||
private bool isInTractionMode = false;
|
||||
private bool isDrillSfxPlaying = false; // 标记音效是否已播放
|
||||
|
||||
void Start()
|
||||
{
|
||||
@@ -400,7 +402,7 @@ public class GearFollower : MonoBehaviour
|
||||
if (gearRenderer != null)
|
||||
{
|
||||
gearRenderer.sortingOrder = 5;
|
||||
}
|
||||
} // 只在未播放时播放音效
|
||||
}
|
||||
}
|
||||
private void UpdateTractionState(Vector2 mousePos)
|
||||
@@ -409,8 +411,6 @@ public class GearFollower : MonoBehaviour
|
||||
|
||||
if (Vector2.Distance(mousePos, gearPos) > detachDistance)
|
||||
{
|
||||
currentState = State.Follow;
|
||||
isInTractionMode = false;
|
||||
EndCutting();
|
||||
return;
|
||||
}
|
||||
@@ -419,7 +419,7 @@ public class GearFollower : MonoBehaviour
|
||||
EndCutting();
|
||||
return;
|
||||
}
|
||||
if (!isCutting)
|
||||
if (!isCutting && Input.GetMouseButton(0))
|
||||
{
|
||||
StartCutting();
|
||||
}
|
||||
@@ -513,14 +513,10 @@ public class GearFollower : MonoBehaviour
|
||||
{
|
||||
sparkVFX.Play();
|
||||
}
|
||||
// 播放切割音效
|
||||
var audioManager = AibisDream.Kit.AudioManager.Instance;
|
||||
if (audioManager != null)
|
||||
{
|
||||
audioManager.PlaySfx("event:/FollowInput/drill");
|
||||
// 快速将is_drill_cutting参数从0拉到1
|
||||
audioManager.SetGlobalParam("is_drill_cutting", 1f);
|
||||
}
|
||||
|
||||
|
||||
AudioManager.Instance.SetSfxParam("event:/FollowInput/drill","is_drill_cutting",1f);
|
||||
|
||||
}
|
||||
private void AddCutPoint(Vector3 point)
|
||||
{
|
||||
@@ -577,22 +573,18 @@ public class GearFollower : MonoBehaviour
|
||||
sparkVFX.Stop();
|
||||
}
|
||||
|
||||
// AudioManager.Instance.SetGlobalParam("is_drill_cutting", 0f);
|
||||
AudioManager.Instance.SetSfxParam("event:/FollowInput/drill","is_drill_cutting",0f);
|
||||
|
||||
// 关闭切割光照
|
||||
if (cutLight != null)
|
||||
{
|
||||
cutLight.enabled = false;
|
||||
cutLight.intensity = 0f;
|
||||
}
|
||||
|
||||
// 停止切割音效
|
||||
var audioManager = AibisDream.Kit.AudioManager.Instance;
|
||||
if (audioManager != null)
|
||||
{
|
||||
// 快速将is_drill_cutting参数从1拉到0
|
||||
audioManager.SetGlobalParam("is_drill_cutting", 0f);
|
||||
audioManager.StopSfx("event:/FollowInput/drill");
|
||||
}
|
||||
// 停止音效
|
||||
}
|
||||
|
||||
private int FindNearestEdgePointIndex(Vector2 pos, out float minDist)
|
||||
{
|
||||
int nearestIndex = 0;
|
||||
@@ -777,8 +769,7 @@ public class GearFollower : MonoBehaviour
|
||||
if (audioManager != null)
|
||||
{
|
||||
// 快速将is_drill_cutting参数从1拉到0
|
||||
audioManager.SetGlobalParam("is_drill_cutting", 0f);
|
||||
audioManager.StopSfx("event:/FollowInput/drill");
|
||||
AudioManager.Instance.SetSfxParam("event:/FollowInput/drill","is_drill_cutting",0f);
|
||||
}
|
||||
|
||||
// 计算随机方向
|
||||
@@ -792,6 +783,7 @@ public class GearFollower : MonoBehaviour
|
||||
}
|
||||
|
||||
// 立即应用倾斜和位移
|
||||
AudioManager.Instance.PlaySfx("event:/ActionFB/mod_cutout");
|
||||
targetSpriteRenderer.transform.rotation = Quaternion.Euler(0, 0, randomAngle);
|
||||
targetSpriteRenderer.transform.position = originalTargetPosition + (Vector3)randomOffset;
|
||||
|
||||
@@ -862,5 +854,17 @@ public class GearFollower : MonoBehaviour
|
||||
{
|
||||
cutCompleteSequence.Kill();
|
||||
}
|
||||
StopDrillSfxIfPlaying();
|
||||
}
|
||||
|
||||
// 停止音效的辅助方法
|
||||
private void StopDrillSfxIfPlaying()
|
||||
{
|
||||
var audioManager = AibisDream.Kit.AudioManager.Instance;
|
||||
if (audioManager != null)
|
||||
{
|
||||
audioManager.StopSfx("event:/FollowInput/drill");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,6 +160,8 @@ namespace AibisDream.FixSystem
|
||||
|
||||
// 打开所有模块
|
||||
FixSystemCenter.SystemDic.Get<BodyModuleSystem>().OpenModuleSlots();
|
||||
AudioManager.Instance.PlaySfx("event:/ActionFB/mods_open");
|
||||
AudioManager.Instance.PlaySfx("event:/FollowInput/plugpick");
|
||||
}
|
||||
|
||||
private void OnPointerUp(BaseEventData eventData)
|
||||
|
||||
@@ -571,6 +571,7 @@ namespace AibisDream.FixSystem
|
||||
|
||||
yield return CameraKit.Instance.SwitchCamera(CameraEnum.CutEmo);
|
||||
yield return UIManager.Instance.GetPanel<PlayToolPanel>().FadeInAsync(0.1f);
|
||||
AudioManager.Instance.SetGlobalParam("scene",14);
|
||||
yield return CameraKit.Instance.SwitchCamera(CameraEnum.CutEmoDeep);
|
||||
yield return UIManager.Instance.GetPanel<PlayToolPanel>().FadeOutAsync(0.1f);
|
||||
yield return cuttingManager.StartCutting(bodyModule);
|
||||
@@ -621,6 +622,7 @@ namespace AibisDream.FixSystem
|
||||
|
||||
yield return CameraKit.Instance.SwitchCamera(CameraEnum.CutMemory);
|
||||
yield return UIManager.Instance.GetPanel<PlayToolPanel>().FadeInAsync(0.1f);
|
||||
AudioManager.Instance.SetGlobalParam("scene",12);
|
||||
yield return CameraKit.Instance.SwitchCamera(CameraEnum.CutMemoryDeep);
|
||||
yield return UIManager.Instance.GetPanel<PlayToolPanel>().FadeOutAsync(0.1f);
|
||||
yield return cuttingManager.StartCutting(bodyModule);
|
||||
@@ -670,6 +672,7 @@ namespace AibisDream.FixSystem
|
||||
|
||||
yield return CameraKit.Instance.SwitchCamera(CameraEnum.CutLogic);
|
||||
yield return UIManager.Instance.GetPanel<PlayToolPanel>().FadeInAsync(0.1f);
|
||||
AudioManager.Instance.SetGlobalParam("scene",13);
|
||||
yield return CameraKit.Instance.SwitchCamera(CameraEnum.CutLogicDeep);
|
||||
yield return UIManager.Instance.GetPanel<PlayToolPanel>().FadeOutAsync(0.1f);
|
||||
yield return cuttingManager.StartCutting(bodyModule);
|
||||
|
||||
@@ -71,6 +71,16 @@ public class ShockSystem : MonoBehaviour
|
||||
[SerializeField] private float abnormalPanelShakeSpeed = 15f; // 异常状态下面板震动速度
|
||||
[SerializeField] private Color abnormalProgressBarColor = Color.red; // 异常状态下进度条颜色
|
||||
|
||||
[Header("Audio Settings")]
|
||||
[SerializeField] private string chargingEvent = "event:/FollowInput/defib/defib_charging";
|
||||
[SerializeField] private string shockEvent = "event:/FollowInput/defib/defib_shock";
|
||||
[SerializeField] private string defibProgressParam = "defibProgress";
|
||||
[SerializeField] private string shockReverbParam = "reverb";
|
||||
[SerializeField] private float shockFlashDelay = 0.05f; // 声音与闪烁的延迟,可配置
|
||||
[Range(0,1)] public float shockReverb = 0f; // 0=真实,1=梦境
|
||||
private string chargingAudioKey = "defib_charging";
|
||||
private string shockAudioKey = "defib_shock";
|
||||
|
||||
private bool isCharging = false;
|
||||
private float currentProgress = 0f;
|
||||
private float currentLeverAngle = 0f; // 当前杆的角度
|
||||
@@ -191,6 +201,8 @@ public class ShockSystem : MonoBehaviour
|
||||
{
|
||||
isCharging = true;
|
||||
StartCharging();
|
||||
// 开始播放充能音效
|
||||
AibisDream.Kit.AudioManager.Instance.PlaySfx(chargingEvent, chargingAudioKey);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -258,6 +270,9 @@ public class ShockSystem : MonoBehaviour
|
||||
|
||||
private void ResetProgress()
|
||||
{
|
||||
// 停止充能音效
|
||||
AibisDream.Kit.AudioManager.Instance.StopSfx(chargingAudioKey);
|
||||
|
||||
// 开始进度条平滑下降
|
||||
if (progressTweener != null)
|
||||
{
|
||||
@@ -290,6 +305,10 @@ public class ShockSystem : MonoBehaviour
|
||||
int progressValue = Mathf.FloorToInt(currentProgress);
|
||||
progressBar.CurrentValue = progressValue;
|
||||
|
||||
// 同步defibProgress参数到音频
|
||||
float progressParam = Mathf.Clamp01(currentProgress / progressBar.MaxValue);
|
||||
AibisDream.Kit.AudioManager.Instance.SetSfxParam(chargingAudioKey, defibProgressParam, progressParam);
|
||||
|
||||
// 计算震动强度
|
||||
float currentVibrateStrength = Mathf.Lerp(minVibrateStrength, maxVibrateStrength, progressRatio);
|
||||
|
||||
@@ -356,6 +375,13 @@ public class ShockSystem : MonoBehaviour
|
||||
flashSequence.Kill();
|
||||
}
|
||||
|
||||
// 先播放shock音效
|
||||
AibisDream.Kit.AudioManager.Instance.PlaySfx(shockEvent, shockAudioKey);
|
||||
// 设置reverb参数
|
||||
AibisDream.Kit.AudioManager.Instance.SetSfxParam(shockAudioKey, shockReverbParam, shockReverb);
|
||||
// 延迟shockFlashDelay秒后再闪烁
|
||||
yield return new WaitForSeconds(shockFlashDelay);
|
||||
|
||||
// 获取ECG波形组件
|
||||
var lightSystem = FixSystemCenter.SystemDic.Get<FixLightSystem>();
|
||||
var originalWaveType = lightSystem?.GetCurrentWaveType();
|
||||
|
||||
@@ -6,6 +6,7 @@ using AibisDream.Framework;
|
||||
using FMOD;
|
||||
using FMOD.Studio;
|
||||
using FMODUnity;
|
||||
using UnityEngine;
|
||||
using STOP_MODE = FMOD.Studio.STOP_MODE;
|
||||
|
||||
namespace AibisDream.Kit
|
||||
@@ -360,6 +361,42 @@ namespace AibisDream.Kit
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void StopSfxWithDelay(string key, string paramName, float paramValue, float delay, STOP_MODE stopMode = STOP_MODE.ALLOWFADEOUT)
|
||||
{
|
||||
if (_sfxDict.TryGetValue(key, out var sfx))
|
||||
{
|
||||
StartCoroutine(DelayedStop(sfx, key, paramName, paramValue, delay, stopMode));
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator DelayedStop(EventInstance instance, string key, string paramName, float paramValue, float delay, STOP_MODE stopMode)
|
||||
{
|
||||
instance.setParameterByName(paramName, paramValue);
|
||||
yield return new WaitForSeconds(delay);
|
||||
|
||||
instance.stop(stopMode);
|
||||
instance.release();
|
||||
RemoveSfx(key);
|
||||
}
|
||||
|
||||
public void StopMusicWithDelay(string key, string paramName, float paramValue, float delay, STOP_MODE stopMode = STOP_MODE.ALLOWFADEOUT)
|
||||
{
|
||||
if (_musicDict.TryGetValue(key, out var music))
|
||||
{
|
||||
StartCoroutine(DelayedStopMusic(music, key, paramName, paramValue, delay, stopMode));
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator DelayedStopMusic(EventInstance instance, string key, string paramName, float paramValue, float delay, STOP_MODE stopMode)
|
||||
{
|
||||
instance.setParameterByName(paramName, paramValue);
|
||||
yield return new WaitForSeconds(delay);
|
||||
|
||||
instance.stop(stopMode);
|
||||
instance.release();
|
||||
RemoveMusic(key);
|
||||
}
|
||||
}
|
||||
|
||||
public interface IAudioManager
|
||||
|
||||
Reference in New Issue
Block a user