Skip to content

Commit

Permalink
feat: 각 Plan 완료시 Sound 추가 (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
scarleter99 authored Jun 18, 2024
1 parent 75e7f18 commit 6a434f1
Show file tree
Hide file tree
Showing 27 changed files with 71 additions and 149 deletions.
97 changes: 0 additions & 97 deletions Client/Assets/Resources/Prefabs/Map/CargoPassageGate.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,6 @@ GameObject:
- component: {fileID: 7236642029869414185}
- component: {fileID: 7236642029869018556}
- component: {fileID: 7236642029869018544}
- component: {fileID: 7236642029869018547}
- component: {fileID: 7236642029869018557}
- component: {fileID: 6901989839342170547}
- component: {fileID: 8499400162952924396}
Expand Down Expand Up @@ -489,102 +488,6 @@ LODGroup:
- renderer: {fileID: 7236642029871183299}
- renderer: {fileID: 7236642029871183301}
m_Enabled: 1
--- !u!82 &7236642029869018547
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7236642029868985097}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: a9c28358083d2c74cb4ee2cf423f6ad8, type: 3}
m_PlayOnAwake: 0
m_Volume: 0.506
m_Pitch: 1
Loop: 0
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!95 &7236642029869018557
Animator:
serializedVersion: 5
Expand Down
7 changes: 6 additions & 1 deletion Client/Assets/Scenes/TestScene/TestScene_SJ.unity
Original file line number Diff line number Diff line change
Expand Up @@ -9437,6 +9437,10 @@ PrefabInstance:
propertyPath: m_Name
value: Map
objectReference: {fileID: 0}
- target: {fileID: 6825217453611155057, guid: 5231a4bab55a19a4b9326cb5ecc5b6c7, type: 3}
propertyPath: m_audioClip
value:
objectReference: {fileID: 0}
- target: {fileID: 7865775579036726535, guid: 5231a4bab55a19a4b9326cb5ecc5b6c7, type: 3}
propertyPath: m_LocalPosition.x
value: 12.25
Expand Down Expand Up @@ -9477,7 +9481,8 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedComponents:
- {fileID: 6825217453611155057, guid: 5231a4bab55a19a4b9326cb5ecc5b6c7, type: 3}
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,23 @@ protected override void Rpc_WorkComplete()
{
CurrentWorkAmount = 0;
Managers.GameMng.PlanSystem.BatteryChargeCount++;

if (Managers.GameMng.PlanSystem.BatteryChargeCount == Define.BATTERY_CHARGE_GOAL)
{
Rpc_PlayCompleteSound();
}
}

[Rpc(RpcSources.All, RpcTargets.All)]
protected override void Rpc_PlaySound()
{
Managers.SoundMng.PlayObjectAudio(AudioSource, $"{Define.EFFECT_PATH}/Interactable/BatteryCharger", 1f, 1f, isLoop: false);
}

[Rpc(RpcSources.StateAuthority, RpcTargets.All)]
protected void Rpc_PlayCompleteSound()
{
Managers.SoundMng.Play($"{Define.EFFECT_PATH}/Interactable/Plan_BatteryCharge", volume:0.5f ,isOneShot:true);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,19 @@ protected override void Rpc_WorkComplete()
{
gate.Open();
}

Rpc_PlayCompleteSound();
}

[Rpc(RpcSources.All, RpcTargets.All)]
protected override void Rpc_PlaySound()
{
Managers.SoundMng.PlayObjectAudio(AudioSource, $"{Define.EFFECT_PATH}/Interactable/GeneratorController", 1f, 1f, isLoop: true);
Managers.SoundMng.PlayObjectAudio(AudioSource, $"{Define.EFFECT_PATH}/Interactable/KeypadUse", 1f, 1f, isLoop: true);
}

[Rpc(RpcSources.StateAuthority, RpcTargets.All)]
protected void Rpc_PlayCompleteSound()
{
Managers.SoundMng.Play($"{Define.EFFECT_PATH}/Interactable/Plan_B", isOneShot:true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ protected override void Init()
CanRememberWork = false;
IsCompleted = false;

TotalWorkAmount = 3f;
TotalWorkAmount = 2f;
}

public override bool IsInteractable(Creature creature)
Expand Down Expand Up @@ -58,11 +58,22 @@ protected override void Rpc_WorkComplete()
{
CurrentWorkAmount = 0;
Managers.GameMng.PlanSystem.USBKeyInsertCount++;

if (Managers.GameMng.PlanSystem.USBKeyInsertCount == Define.USBKEY_INSERT_GOAL)
{
Rpc_PlayCompleteSound();
}
}

[Rpc(RpcSources.All, RpcTargets.All)]
protected override void Rpc_PlaySound()
{
Managers.SoundMng.PlayObjectAudio(AudioSource, $"{Define.EFFECT_PATH}/Interactable/Insert", 1f, 1f, isLoop: false);
}

[Rpc(RpcSources.StateAuthority, RpcTargets.All)]
protected void Rpc_PlayCompleteSound()
{
Managers.SoundMng.Play($"{Define.EFFECT_PATH}/Interactable/Plan_A", volume:0.5f ,isOneShot:true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ protected override void Rpc_WorkComplete()
[Rpc(RpcSources.All, RpcTargets.All)]
protected override void Rpc_PlaySound()
{
Managers.SoundMng.PlayObjectAudio(AudioSource, $"{Define.EFFECT_PATH}/Interactable/GeneratorController", 1f, 1f, isLoop: true);
Managers.SoundMng.PlayObjectAudio(AudioSource, $"{Define.EFFECT_PATH}/Interactable/KeypadUse", 1f, 1f, isLoop: true);
}
}
2 changes: 1 addition & 1 deletion Client/Assets/Scripts/Contents/Items/FlashBang.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected void Explode(Vector3 attackPosition)
Collider[] hitColliders = new Collider[4];

if (Physics.OverlapSphereNonAlloc(attackPosition, 6f, hitColliders,
LayerMask.GetMask("Crew", "Alien")) > 0)
LayerMask.GetMask("Alien")) > 0)
{
foreach (var hitCollider in hitColliders)
if (hitCollider.gameObject.TryGetComponent(out Creature creature))
Expand Down
8 changes: 0 additions & 8 deletions Client/Assets/Scripts/Contents/Map/Gate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,10 @@ public class Gate : NetworkBehaviour
public void Open()
{
GetComponent<NetworkMecanimAnimator>().Animator.SetBool("IsOpen", true);
Rpc_PlaySound();
}

public void Close()
{
GetComponent<NetworkMecanimAnimator>().Animator.SetBool("IsOpen", false);
Rpc_PlaySound();
}

[Rpc(RpcSources.All, RpcTargets.All)]
private void Rpc_PlaySound()
{
GetComponent<AudioSource>().Play();
}
}
11 changes: 8 additions & 3 deletions Client/Assets/Scripts/Managers/Core/SoundManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ public void Clear()
_audioClips.Clear();
}

public void Play(string path, Define.SoundType type = Define.SoundType.Effect, float pitch = 1.0f, float volume = 1.0f, bool isLoop = false)
public void Play(string path, Define.SoundType type = Define.SoundType.Effect, float pitch = 1.0f, float volume = 1.0f, bool isLoop = false, bool isOneShot = false)
{
AudioClip audioClip = GetOrAddAudioClip(path, type);
Play(audioClip, type, pitch, volume, isLoop);
Play(audioClip, type, pitch, volume, isLoop, isOneShot);
}

public void Play(AudioClip audioClip, Define.SoundType type = Define.SoundType.Effect, float pitch = 1.0f, float volume = 1.0f, bool isLoop = false)
public void Play(AudioClip audioClip, Define.SoundType type = Define.SoundType.Effect, float pitch = 1.0f, float volume = 1.0f, bool isLoop = false, bool isOneShot = false)
{
if (audioClip == null)
return;
Expand All @@ -63,6 +63,11 @@ public void Play(AudioClip audioClip, Define.SoundType type = Define.SoundType.E
if (type == Define.SoundType.Effect)
{
audioSource = _audioSources[(int)Define.SoundType.Effect];
if (isOneShot)
{
audioSource.PlayOneShot(audioClip);
return;
}
audioSource.loop = isLoop;
}
else if (type == Define.SoundType.Bgm)
Expand Down
2 changes: 1 addition & 1 deletion Client/Assets/Scripts/Systems/PlanSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void EnablePlanC()
if (Managers.ObjectMng.MyCreature is Alien) return;

if (!IsBatteryChargeFinished) return;

GameObject.FindGameObjectsWithTag("EmergencyControlDevice").SetLayerRecursive(LayerMask.NameToLayer("PlanTargetObject"));
Managers.ObjectMng.MyCrew.CrewIngameUI.PlanUI.EnablePlanC();
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6a434f1

Please sign in to comment.