From e61459bb7122ccbe13fe3630b8efd11d3fac61fc Mon Sep 17 00:00:00 2001 From: pyoneerC Date: Tue, 24 Sep 2024 17:35:58 -0300 Subject: [PATCH] feat: welder particles --- Assets/Scenes/Reparation.unity | 9 +++++++++ Assets/Scripts/FixLogic.cs | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/Assets/Scenes/Reparation.unity b/Assets/Scenes/Reparation.unity index 4dc226b..9ecee0f 100644 --- a/Assets/Scenes/Reparation.unity +++ b/Assets/Scenes/Reparation.unity @@ -2445,6 +2445,11 @@ Transform: m_CorrespondingSourceObject: {fileID: -5819118886272102141, guid: c2c82adf9ac2fdc4cae5ff03189357ae, type: 3} m_PrefabInstance: {fileID: 470749343} m_PrefabAsset: {fileID: 0} +--- !u!1 &180829341 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 1329845292236604, guid: 9bba9cf244c53c5439505dfc96fdd11c, type: 3} + m_PrefabInstance: {fileID: 349481580} + m_PrefabAsset: {fileID: 0} --- !u!1001 &188083860 PrefabInstance: m_ObjectHideFlags: 0 @@ -13373,6 +13378,10 @@ PrefabInstance: propertyPath: weldingSound value: objectReference: {fileID: 8300000, guid: 943919089a11d73468a581b3d1940529, type: 3} + - target: {fileID: 4614605577419265582, guid: 6bacecc4f3df9584198879c73a6b6c36, type: 3} + propertyPath: welderParticles + value: + objectReference: {fileID: 180829341} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: diff --git a/Assets/Scripts/FixLogic.cs b/Assets/Scripts/FixLogic.cs index 4cb82e1..73c72a0 100644 --- a/Assets/Scripts/FixLogic.cs +++ b/Assets/Scripts/FixLogic.cs @@ -6,10 +6,17 @@ public class FixLogic : MonoBehaviour public int fixedCount; public AudioSource audioSource; public AudioClip weldingSound; + public GameObject welderParticles; + private bool _isOverlapping; private GameObject _currentLeak; private bool _isFixing; + private void Start() + { + welderParticles.SetActive(false); + } + private void OnTriggerEnter(Collider other) { if (!other.CompareTag("Leak")) return; @@ -25,6 +32,7 @@ private void OnTriggerExit(Collider other) _currentLeak = null; audioSource.Stop(); Debug.Log("Exited leak area."); + welderParticles.SetActive(false); } private void Update() @@ -32,6 +40,7 @@ private void Update() if (!_isOverlapping || !Input.GetKey(KeyCode.F) || _isFixing) return; StartCoroutine(FixLeak()); audioSource.PlayOneShot(weldingSound); + welderParticles.SetActive(true); } private IEnumerator FixLeak() @@ -50,6 +59,7 @@ private IEnumerator FixLeak() if (!_isOverlapping || _currentLeak == null) { Debug.Log("No longer overlapping with leak. Fix aborted."); + welderParticles.SetActive(false); _isFixing = false; yield break; }