齿轮音效

This commit is contained in:
2024-12-31 04:38:47 +08:00
parent cc8ac8bf62
commit 2fcbea4056
13 changed files with 399 additions and 6 deletions
Binary file not shown.
@@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: d2d71ce661aebfb479f7927023c20cfc
AudioImporter:
externalObjects: {}
serializedVersion: 7
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
@@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: edfc3a76c01c21e448735fe6e2a10b96
AudioImporter:
externalObjects: {}
serializedVersion: 7
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
@@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: 4b82bfed42e95dd43ac559d0226cf12c
AudioImporter:
externalObjects: {}
serializedVersion: 7
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:
+4 -4
View File
@@ -16,7 +16,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!4 &321962101837076397
Transform:
m_ObjectHideFlags: 0
@@ -166,7 +166,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!4 &7053611760725568351
Transform:
m_ObjectHideFlags: 0
@@ -404,7 +404,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!4 &6255869994967285290
Transform:
m_ObjectHideFlags: 0
@@ -824,7 +824,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!4 &557159831907654330
Transform:
m_ObjectHideFlags: 0
@@ -800,6 +800,8 @@ Transform:
m_Children:
- {fileID: 978527555660104375}
- {fileID: 9053731432274197797}
- {fileID: 4268419905980150376}
- {fileID: 2029144652665450398}
- {fileID: 4517563608897647978}
- {fileID: 8704957973411935911}
- {fileID: 8958232513318718903}
@@ -948,3 +950,259 @@ AudioSource:
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!1 &7726957597452757375
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4268419905980150376}
- component: {fileID: 3385871051024393721}
m_Layer: 0
m_Name: Loop3
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4268419905980150376
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7726957597452757375}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8180040489590280703}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!82 &3385871051024393721
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7726957597452757375}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 8866379113506573767, guid: b14347481450a234a852407119bfecb4, type: 2}
m_audioClip: {fileID: 0}
m_PlayOnAwake: 0
m_Volume: 0.659
m_Pitch: 1
Loop: 1
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!1 &8879056570523940757
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2029144652665450398}
- component: {fileID: 3634632532610254604}
m_Layer: 0
m_Name: Loop4
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2029144652665450398
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8879056570523940757}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8180040489590280703}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!82 &3634632532610254604
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8879056570523940757}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 8866379113506573767, guid: b14347481450a234a852407119bfecb4, type: 2}
m_audioClip: {fileID: 0}
m_PlayOnAwake: 0
m_Volume: 0.659
m_Pitch: 1
Loop: 1
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
@@ -19,6 +19,7 @@ namespace AibisDream.FixSystem
public IEnumerator CharacterInit(string characterName)
{
// 异步加载角色预制体(psb
ResourceRequest request = Resources.LoadAsync<GameObject>($"Characters/{characterName}");
yield return request;
@@ -40,6 +41,7 @@ namespace AibisDream.FixSystem
GameObject characterPrefab = request.asset as GameObject;
_curCharacter = Instantiate(characterPrefab, transform);
Debug.LogError(_curCharacter.gameObject.name);
// 初始化处理
_curCharacter.SetActive(false);
_blinkLayer = _curCharacter.transform.Find("闭眼").GetComponent<SpriteRenderer>();
@@ -61,7 +63,7 @@ namespace AibisDream.FixSystem
private static void ActiveLayer(Transform root, string layerName = null)
{
var childLayers = root.GetComponentsInChildren<SpriteRenderer>();
var childLayers = root.GetComponentsInChildren<SpriteRenderer>(true);
if (childLayers.Length == 0) return;
foreach (var layer in childLayers)
@@ -79,7 +81,7 @@ namespace AibisDream.FixSystem
private void SetCharacterAlpha(float alpha)
{
_characterAlpha = alpha;
SpriteRenderer[] renderers = _curCharacter.GetComponentsInChildren<SpriteRenderer>();
SpriteRenderer[] renderers = _curCharacter.GetComponentsInChildren<SpriteRenderer>(true);
foreach (var childRenderer in renderers)
{
Color color = childRenderer.color;
@@ -9,6 +9,7 @@ namespace AibisDream
{
private const string LoopSource = "Loop";
private const string LoopSource2 = "Loop2";
private const string LoopSource3 = "Loop3";
private const string InteractionSource = "Interaction";
private const string VoiceSource = "Voice";
private const string MemorySource = "Memery";
@@ -17,6 +18,7 @@ namespace AibisDream
private AudioSource _loopSource;
private AudioSource _loopSource2;
private AudioSource _loopSource3;
private AudioSource _interactionSource;
private AudioSource _voiceSource;
private AudioSource _memorySource;
@@ -29,6 +31,7 @@ namespace AibisDream
{
_loopSource = transform.Find(LoopSource).GetComponent<AudioSource>();
_loopSource2 = transform.Find(LoopSource2).GetComponent<AudioSource>();
_loopSource3 = transform.Find(LoopSource3).GetComponent<AudioSource>();
_interactionSource = transform.Find(InteractionSource).GetComponent<AudioSource>();
_voiceSource = transform.Find(VoiceSource).GetComponent<AudioSource>();
_memorySource = transform.Find(MemorySource).GetComponent<AudioSource>();
@@ -138,6 +141,26 @@ namespace AibisDream
Instance._loopSource2.Pause();
}
[YarnCommand("play_loop3_audio")]
public static void PlayLoop3Audio(string audioName)
{
AudioClip clip = Resources.Load<AudioClip>($"Audio/{audioName}");
if (clip == null)
{
clip = Instance.RandomLoadAudioClip(3, $"Audio/{audioName}");
}
Instance._loopSource3.clip = clip;
Instance._loopSource3.Play();
}
[YarnCommand("pause_loop3_audio")]
public static void PauseLoop3Audio()
{
Instance._loopSource3.Pause();
}
public void ContinueLoopAudio()
{
_loopSource.UnPause();
@@ -49,6 +49,14 @@ namespace AibisDream.Framework
{
if (Input.GetKeyDown(KeyCode.K))
{
Debug.Log(1);
ClinicYarnCommand.CharacterInit("石头");
}
if (Input.GetKeyDown(KeyCode.A))
{
ClinicYarnCommand.CharacterFadeIn();
ClinicYarnCommand.CharacterFace("正常微微笑");
}
}
}
@@ -103,6 +103,14 @@ namespace AibisDream
public void CheckGearSystemState()
{
if (_isTargetReached)
{
AudioManager.PlayLoop3Audio("gears_running");
}
else
{
AudioManager.PauseLoop3Audio();
}
DialogController.Instance.StartDialogNode("齿轮系统状态变化");
}
@@ -128,6 +136,7 @@ namespace AibisDream
public IEnumerator OpenCover()
{
AudioManager.PlayLoop2Audio("amb_gearbox");
// 旋转拉杆
yield return _coverStick.DORotate(new Vector3(0, 0, -90), 1.5f).WaitForCompletion();
// 开盖
@@ -139,6 +148,8 @@ namespace AibisDream
public IEnumerator CloseCover()
{
AudioManager.PauseLoopAudio();
AudioManager.PauseLoop2Audio();
// 关盖
var sq = DOTween.Sequence();
sq.Join(_cover.transform.DOLocalMove(coverDownPos, 1.5f));
+13
View File
@@ -1,5 +1,6 @@
using System;
using AibisDream.Framework;
using AibisDream.Utility;
using DG.Tweening;
using Newtonsoft.Json;
using UnityEngine;
@@ -91,6 +92,7 @@ namespace AibisDream
childGear = gear;
gear.transform.parent = transform;
_gearSystem.ChangeGraphVertex(GetInstanceID());
// 面板里的齿轮才能触发
if (transform.parent.name == "Shafts")
{
@@ -101,6 +103,12 @@ namespace AibisDream
private void OnGearPlugIn()
{
// 插入音效
if (!CommonUtil.IsZero(speed) && IsBroken)
{
AudioManager.PlayLoopAudio("gearbox_bad");
}
// 破损齿轮插进来就发一次事件,交给yarn处理
if (IsBroken)
{
@@ -115,6 +123,11 @@ namespace AibisDream
public void PlugOutGear()
{
if (IsBroken)
{
AudioManager.PauseLoopAudio();
}
// 拔出时齿轮停转
childGear.UpdateRotation(0, _speedScale);