@@ -9,6 +9,7 @@ public class FixLogic : MonoBehaviour
9
9
public AudioClip weldingSound ;
10
10
public GameObject welderParticles ;
11
11
public Welder welder ;
12
+ public GameObject welderPrefab ;
12
13
13
14
// Minimap circles and particles
14
15
public GameObject circle0 ;
@@ -46,7 +47,7 @@ private void OnTriggerEnter(Collider other)
46
47
if ( ! other . CompareTag ( "Leak" ) ) return ;
47
48
_isOverlapping = true ;
48
49
_currentLeak = other . gameObject ;
49
- Debug . Log ( "Overlapping with leak. Hold 'F' to fix." ) ;
50
+ StartCoroutine ( RotateWelder ( ) ) ;
50
51
}
51
52
52
53
private void OnTriggerExit ( Collider other )
@@ -87,6 +88,8 @@ private IEnumerator FixLeak()
87
88
yield return null ;
88
89
}
89
90
91
+ StartCoroutine ( RotateWelder ( ) ) ;
92
+
90
93
if ( ! _isOverlapping || _currentLeak == null )
91
94
{
92
95
Debug . Log ( "No longer overlapping with leak. Fix aborted." ) ;
@@ -106,6 +109,8 @@ private IEnumerator FixLeak()
106
109
107
110
_isOverlapping = false ;
108
111
_isFixing = false ;
112
+
113
+ StartCoroutine ( RotateWelder ( ) ) ;
109
114
}
110
115
111
116
private void HandleMinimapCirclesAndParticles ( )
@@ -169,4 +174,25 @@ private static void GameOver()
169
174
{
170
175
Debug . Log ( "Game Over! You fixed 7 leaks." ) ;
171
176
}
177
+
178
+ private IEnumerator RotateWelder ( )
179
+ {
180
+ var originalRotation = welderPrefab . transform . rotation ;
181
+ var targetRotation = originalRotation * Quaternion . Euler ( 10f , 10f , 0f ) ;
182
+
183
+ const float rotateDuration = 0.5f ;
184
+ for ( float t = 0 ; t < rotateDuration ; t += Time . deltaTime )
185
+ {
186
+ welderPrefab . transform . rotation = Quaternion . Lerp ( originalRotation , targetRotation , t / rotateDuration ) ;
187
+ yield return null ;
188
+ }
189
+ welderPrefab . transform . rotation = targetRotation ;
190
+
191
+ for ( float t = 0 ; t < rotateDuration ; t += Time . deltaTime )
192
+ {
193
+ welderPrefab . transform . rotation = Quaternion . Lerp ( targetRotation , originalRotation , t / rotateDuration ) ;
194
+ yield return null ;
195
+ }
196
+ welderPrefab . transform . rotation = originalRotation ;
197
+ }
172
198
}
0 commit comments