TO SQUASH: Fixed issue.

This commit is contained in:
2026-08-27 15:34:06 -04:00
parent 21b0fd7648
commit 04ccf01eb4
6 changed files with 117 additions and 14 deletions
+8
View File
@@ -54,6 +54,14 @@ public class BallBase : MonoBehaviour
{
player.GetComponent<Player>().OnBarHit();
}
// Notify other systems if needed.
var worldFiller = GameObject.FindGameObjectWithTag("WorldFiller");
if (worldFiller != null)
{
worldFiller.GetComponent<WorldFiller>().ClearWalls();
}
}
}
+49
View File
@@ -107,6 +107,12 @@ public class LevelEnder : MonoBehaviour
{
addScoreTimer = 0.0f;
addScoreToPlayer = AddScore();
if (!addScoreToPlayer)
{
tallyShown = false;
StartCoroutine(ProceedToNextLevel());
}
}
}
}
@@ -260,4 +266,47 @@ public class LevelEnder : MonoBehaviour
yield return new WaitForSeconds(7.3f - 3.0f - (player.multiplier != 1.0f ? 0.75f : 0.0f));
addScoreToPlayer = true;
}
private IEnumerator ProceedToNextLevel()
{
musicManager.PauseMusic();
yield return new WaitForSeconds(1.0f);
player.OnLevelEnd();
// Reenable spawners.
multiplierSpawner.StartSpawning();
sharkSpawner.StartSpawning();
cakeSpawner.StartSpawning();
ballSpawner.StartSpawning();
// Reset state.
levelEnded = false;
tallyShown = false;
addScoreToPlayer = false;
scoreTotal = 0;
addScoreTimer = 0.0f;
// Clear text labels.
timeBonus.text = "";
totalBonus.text = "";
isolationBonus.text = "";
overachieverBonus.text = "";
isolationCount.text = "";
overachieverPercent.text = "";
multiplierBonus.text = "";
overarchieverPercentLabel.enabled = false;
isolationCountSingleLabel.enabled = false;
isolationCountPluralLabel.enabled = false;
// Hide score tally.
levelEndTally.enabled = false;
levelEndTallyBackground.enabled = false;
// TODO: Reset balls.
// Restart music.
musicManager.ResumeMusic();
}
}
+11 -1
View File
@@ -65,12 +65,22 @@ public class MusicManager : MonoBehaviour
{
if (needsReset)
{
if (audioSource.isPlaying)
{
audioSource.Stop();
}
audioSource.clip = null;
clipsQueue.Clear();
ResetQueue();
needsReset = false;
}
audioSource.UnPause();
if (audioSource.clip != null && !audioSource.isPlaying)
{
audioSource.UnPause();
}
isPaused = false;
}
+4 -2
View File
@@ -6,6 +6,8 @@ public class SharkSpawner : Spawner
public SpriteRenderer gameBoardSpriteRenderer;
public Player player;
private Bounds gameBoardBounds;
private float spawnTimer = 0f;
@@ -28,7 +30,7 @@ public class SharkSpawner : Spawner
{
spawnTimer += Time.fixedDeltaTime;
if (spawnTimer >= 1f && isActive && isSpawning)
if (spawnTimer >= 1f && isActive && isSpawning && player.level >= 10)
{
spawnTimer = 0f;
if (Random.value < spawnProbability)
@@ -36,7 +38,7 @@ public class SharkSpawner : Spawner
GameObject shark = Instantiate(sharkPrefab, spawnPosition, Quaternion.identity);
Shark sharkScript = shark.GetComponent<Shark>();
sharkScript.gameBoardSpriteRenderer = gameBoardSpriteRenderer;
sharkScript.player = FindAnyObjectByType<Player>();
sharkScript.player = player;
isActive = false;
}
}