diff --git a/Assets/Scenes/Reparation.unity b/Assets/Scenes/Reparation.unity index 9ecee0f..7d94737 100644 --- a/Assets/Scenes/Reparation.unity +++ b/Assets/Scenes/Reparation.unity @@ -13366,6 +13366,10 @@ PrefabInstance: propertyPath: m_Name value: FirstPersonController objectReference: {fileID: 0} + - target: {fileID: 4614605577419265582, guid: 6bacecc4f3df9584198879c73a6b6c36, type: 3} + propertyPath: welder + value: + objectReference: {fileID: 1128651451} - target: {fileID: 4614605577419265582, guid: 6bacecc4f3df9584198879c73a6b6c36, type: 3} propertyPath: fixSound value: @@ -18616,6 +18620,7 @@ MonoBehaviour: welderPrefab: {fileID: 1071434719} rayDistance: 100 playerCamera: {fileID: 0} + _welderInHand: 0 --- !u!4 &1130256303 stripped Transform: m_CorrespondingSourceObject: {fileID: -5819118886272102141, guid: e0f672a015f8fee418afd70dfd718f0d, type: 3} diff --git a/Assets/Scripts/FixLogic.cs b/Assets/Scripts/FixLogic.cs index 73c72a0..093be6f 100644 --- a/Assets/Scripts/FixLogic.cs +++ b/Assets/Scripts/FixLogic.cs @@ -7,6 +7,7 @@ public class FixLogic : MonoBehaviour public AudioSource audioSource; public AudioClip weldingSound; public GameObject welderParticles; + public Welder welder; private bool _isOverlapping; private GameObject _currentLeak; @@ -37,7 +38,14 @@ private void OnTriggerExit(Collider other) private void Update() { + if (welder != null && !welder.welderInHand) + { + Debug.Log("Welder not in hand. Cannot fix leaks."); + return; + } + if (!_isOverlapping || !Input.GetKey(KeyCode.F) || _isFixing) return; + StartCoroutine(FixLeak()); audioSource.PlayOneShot(weldingSound); welderParticles.SetActive(true); diff --git a/Assets/Scripts/Welder.cs b/Assets/Scripts/Welder.cs index 3432004..ccff2b9 100644 --- a/Assets/Scripts/Welder.cs +++ b/Assets/Scripts/Welder.cs @@ -6,7 +6,7 @@ public class Welder : MonoBehaviour public float rayDistance = 3f; public Camera playerCamera; - private bool _welderInHand; + public bool welderInHand; private void Start() { @@ -43,8 +43,8 @@ private void TryPickUpWelder() hit.collider.gameObject.SetActive(false); - if (_welderInHand) return; + if (welderInHand) return; welderPrefab.SetActive(true); - _welderInHand = true; + welderInHand = true; } } \ No newline at end of file