TO SQUASH: More shark.

This commit is contained in:
2026-08-10 23:04:48 -04:00
parent 14aa42696e
commit d15c7002a8
2 changed files with 7 additions and 3 deletions
+6 -2
View File
@@ -15,7 +15,7 @@ public class Shark : MonoBehaviour
public SpriteRenderer gameBoardSpriteRenderer;
private Bounds gameBoardBounds;
private Bounds? gameBoardBounds = null;
private AudioSource audioSource;
@@ -44,7 +44,6 @@ public class Shark : MonoBehaviour
{
audioSource = GetComponent<AudioSource>();
animator = GetComponent<Animator>();
gameBoardBounds = gameBoardSpriteRenderer.bounds;
bool spawnLeft = Random.Range(0, 2) == 0;
angle = spawnLeft ? 90 : 270;
@@ -55,6 +54,11 @@ public class Shark : MonoBehaviour
// Update is called once per frame
void FixedUpdate()
{
if (gameBoardSpriteRenderer != null && gameBoardBounds == null)
{
gameBoardBounds = gameBoardSpriteRenderer.bounds;
}
// Check if the spawn animation has finished.
if (
(animator.GetCurrentAnimatorStateInfo(0).IsName("SharkSpawnRight") ||
+1 -1
View File
@@ -14,7 +14,7 @@ public class SharkSpawner : MonoBehaviour
private bool isActive = true;
private static float spawnProbability = 0.1f;
private static float spawnProbability = 0.9f;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()