From a669c028580413c6ef5e351f0ea646dbf24d06d5 Mon Sep 17 00:00:00 2001 From: cyndrdev Date: Fri, 16 Apr 2021 15:43:19 +0100 Subject: [PATCH] triggers for freeze sfx & vfx --- game/Assets/GlobalPostFX.asset | 2 +- game/Assets/Prefabs/Player.prefab | 2 ++ game/Assets/Prefabs/PlayerObjects.prefab | 24 +++++++++++-------- .../Assets/Scripts/Player/PlayerController.cs | 11 +++++++++ 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/game/Assets/GlobalPostFX.asset b/game/Assets/GlobalPostFX.asset index 8ef8681..32325d8 100644 --- a/game/Assets/GlobalPostFX.asset +++ b/game/Assets/GlobalPostFX.asset @@ -30,7 +30,7 @@ MonoBehaviour: m_AdvancedMode: 0 threshold: m_OverrideState: 1 - m_Value: 0.6 + m_Value: 0.75 min: 0 intensity: m_OverrideState: 1 diff --git a/game/Assets/Prefabs/Player.prefab b/game/Assets/Prefabs/Player.prefab index 896671c..48d5e2a 100644 --- a/game/Assets/Prefabs/Player.prefab +++ b/game/Assets/Prefabs/Player.prefab @@ -171,6 +171,8 @@ MonoBehaviour: frozenTime: {fileID: 11400000, guid: 19273ba4ac237ab4381926cfb195dda8, type: 2} _dialogueSystem: {fileID: 11400000, guid: 56369c4e83cc59e44bf55cd16fafc4e8, type: 2} _freezeFirstUseDialogueKey: SD_FREEZE_0 + _freezeVfx: {fileID: 0} + _freezeSfx: event:/Character/Freeze --- !u!114 &13726836969441780 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/game/Assets/Prefabs/PlayerObjects.prefab b/game/Assets/Prefabs/PlayerObjects.prefab index da2b557..961d413 100644 --- a/game/Assets/Prefabs/PlayerObjects.prefab +++ b/game/Assets/Prefabs/PlayerObjects.prefab @@ -98,7 +98,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!4 &4125728165250223436 Transform: m_ObjectHideFlags: 0 @@ -203,7 +203,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5661344207112327334, guid: dfbecbd9a563dba43be2d6139d9b3f90, type: 3} propertyPath: m_LocalRotation.x - value: 0.05885306 + value: 0.058853067 objectReference: {fileID: 0} - target: {fileID: 5661344207112327334, guid: dfbecbd9a563dba43be2d6139d9b3f90, type: 3} propertyPath: m_LocalRotation.y @@ -211,7 +211,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5661344207112327334, guid: dfbecbd9a563dba43be2d6139d9b3f90, type: 3} propertyPath: m_LocalRotation.z - value: -0.22208732 + value: -0.22208735 objectReference: {fileID: 0} - target: {fileID: 5661344207112327337, guid: dfbecbd9a563dba43be2d6139d9b3f90, type: 3} propertyPath: m_RenderPostProcessing @@ -235,15 +235,15 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5661344207311831624, guid: dfbecbd9a563dba43be2d6139d9b3f90, type: 3} propertyPath: m_LocalRotation.x - value: 0.000000013038514 + value: -0.0000000018626449 objectReference: {fileID: 0} - target: {fileID: 5661344207311831624, guid: dfbecbd9a563dba43be2d6139d9b3f90, type: 3} propertyPath: m_LocalRotation.y - value: -0.036978524 + value: -0.036978554 objectReference: {fileID: 0} - target: {fileID: 5661344207311831624, guid: dfbecbd9a563dba43be2d6139d9b3f90, type: 3} propertyPath: m_LocalRotation.z - value: 0.018489273 + value: 0.01848928 objectReference: {fileID: 0} - target: {fileID: 5661344207439169721, guid: dfbecbd9a563dba43be2d6139d9b3f90, type: 3} propertyPath: m_LocalPosition.x @@ -263,7 +263,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5661344207439169721, guid: dfbecbd9a563dba43be2d6139d9b3f90, type: 3} propertyPath: m_LocalRotation.x - value: -0.000000016763806 + value: -0.000000014901161 objectReference: {fileID: 0} - target: {fileID: 5661344207439169721, guid: dfbecbd9a563dba43be2d6139d9b3f90, type: 3} propertyPath: m_LocalRotation.y @@ -339,7 +339,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5661344207789115488, guid: dfbecbd9a563dba43be2d6139d9b3f90, type: 3} propertyPath: m_LocalRotation.x - value: 0.05885307 + value: 0.058853067 objectReference: {fileID: 0} - target: {fileID: 5661344207789115488, guid: dfbecbd9a563dba43be2d6139d9b3f90, type: 3} propertyPath: m_LocalRotation.y @@ -391,7 +391,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5661344207849762652, guid: dfbecbd9a563dba43be2d6139d9b3f90, type: 3} propertyPath: m_LocalRotation.x - value: -0.0000000027939675 + value: -0.0000000018626449 objectReference: {fileID: 0} - target: {fileID: 5661344207849762652, guid: dfbecbd9a563dba43be2d6139d9b3f90, type: 3} propertyPath: m_LocalRotation.y @@ -399,7 +399,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5661344207849762652, guid: dfbecbd9a563dba43be2d6139d9b3f90, type: 3} propertyPath: m_LocalRotation.z - value: -0.00000001117587 + value: -0.0000000074505797 objectReference: {fileID: 0} - target: {fileID: 5661344208280186838, guid: dfbecbd9a563dba43be2d6139d9b3f90, type: 3} propertyPath: m_XAxis.Value @@ -544,6 +544,10 @@ PrefabInstance: propertyPath: _camera value: objectReference: {fileID: 4676633831388223340} + - target: {fileID: 13726836969441783, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3} + propertyPath: _freezeVfx + value: + objectReference: {fileID: 7557098150896029248} - target: {fileID: 13726837176080779, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3} propertyPath: _freeze value: diff --git a/game/Assets/Scripts/Player/PlayerController.cs b/game/Assets/Scripts/Player/PlayerController.cs index 35621d4..5fa1792 100644 --- a/game/Assets/Scripts/Player/PlayerController.cs +++ b/game/Assets/Scripts/Player/PlayerController.cs @@ -89,6 +89,13 @@ public class PlayerController : MonoBehaviour [SerializeField] private string _freezeFirstUseDialogueKey; + [SerializeField] + private GameObject _freezeVfx; + + [SerializeField] + [FMODUnity.EventRef] + private string _freezeSfx; + private enum JumpState { None, @@ -103,6 +110,7 @@ public class PlayerController : MonoBehaviour private void Start() { + _freezeVfx.SetActive( false ); } private Color GetDebugColor() @@ -177,6 +185,8 @@ public class PlayerController : MonoBehaviour { _powers.Freeze.Consume(); objectTimeScale.Value = 0f; + _freezeVfx.SetActive( true ); + FMODUnity.RuntimeManager.PlayOneShot( _freezeSfx ); Debug.Log( "[PlayerController] time frozen" ); } @@ -184,6 +194,7 @@ public class PlayerController : MonoBehaviour { UnfreezeTime(); _dialogueSystem.PlayLine( _freezeFirstUseDialogueKey, true ); + _freezeVfx.SetActive( false ); Debug.Log( "[PlayerController] time unfrozen" ); }