Skip to content

Commit

Permalink
fix: no repair on end overlap
Browse files Browse the repository at this point in the history
  • Loading branch information
pyoneerC committed Sep 23, 2024
1 parent 326e0e7 commit ccb85b2
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Assets/Scripts/FixLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ private void OnTriggerExit(Collider other)
if (!other.CompareTag("Leak")) return;
_isOverlapping = false;
_currentLeak = null;
audioSource.Stop();
Debug.Log("Exited leak area.");
}

Expand All @@ -46,6 +47,13 @@ private IEnumerator FixLeak()
yield return null;
}

if (!_isOverlapping || _currentLeak == null)
{
Debug.Log("No longer overlapping with leak. Fix aborted.");
_isFixing = false;
yield break;
}

fixedCount++;
Debug.Log("Leak fixed! Total fixed leaks: " + fixedCount);

Expand All @@ -60,7 +68,7 @@ private IEnumerator FixLeak()
Destroy(child.gameObject);
}
}

Destroy(_currentLeak);
}

Expand All @@ -73,8 +81,8 @@ private IEnumerator FixLeak()
_isFixing = false;
}

private void GameOver()
private static void GameOver()
{
Debug.Log("Game Over! You fixed 7 leaks.");
}
}
}

0 comments on commit ccb85b2

Please sign in to comment.