TO SQUASH: Lots of UI.
This commit is contained in:
@@ -2,7 +2,7 @@ using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class BallSpawner : MonoBehaviour
|
||||
public class BallSpawner : Spawner
|
||||
{
|
||||
public GameObject basicBallPrefab;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class MultiplierSpawner : MonoBehaviour
|
||||
public class MultiplierSpawner : Spawner
|
||||
{
|
||||
public GameObject multiplierPrefab;
|
||||
|
||||
@@ -31,7 +31,7 @@ public class MultiplierSpawner : MonoBehaviour
|
||||
{
|
||||
spawnTimer += Time.fixedDeltaTime;
|
||||
|
||||
if (spawnTimer >= 1f && isActive)
|
||||
if (spawnTimer >= 1f && isActive && isSpawning)
|
||||
{
|
||||
spawnTimer = 0f;
|
||||
if (Random.value < spawnProbability)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class SharkSpawner : MonoBehaviour
|
||||
public class SharkSpawner : Spawner
|
||||
{
|
||||
public GameObject sharkPrefab;
|
||||
|
||||
@@ -14,7 +14,7 @@ public class SharkSpawner : MonoBehaviour
|
||||
|
||||
private bool isActive = true;
|
||||
|
||||
private static float spawnProbability = 0.1f;
|
||||
private static float spawnProbability = 0.05f;
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
@@ -28,7 +28,7 @@ public class SharkSpawner : MonoBehaviour
|
||||
{
|
||||
spawnTimer += Time.fixedDeltaTime;
|
||||
|
||||
if (spawnTimer >= 1f && isActive)
|
||||
if (spawnTimer >= 1f && isActive && isSpawning)
|
||||
{
|
||||
spawnTimer = 0f;
|
||||
if (Random.value < spawnProbability)
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
using UnityEngine;
|
||||
|
||||
public abstract class Spawner : MonoBehaviour
|
||||
{
|
||||
protected bool isSpawning = true;
|
||||
|
||||
public void StopSpawning()
|
||||
{
|
||||
isSpawning = false;
|
||||
}
|
||||
|
||||
public void StartSpawning()
|
||||
{
|
||||
isSpawning = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e4522281a93a1ffc088f8bb7abaf7f07
|
||||
Reference in New Issue
Block a user