TO SQUASH: Fixed issues.
This commit is contained in:
@@ -6,6 +6,8 @@ public class MultiplierSpawner : Spawner
|
||||
|
||||
public SpriteRenderer gameBoardSpriteRenderer;
|
||||
|
||||
public WorldFiller worldFiller;
|
||||
|
||||
private Bounds multiplierBounds;
|
||||
|
||||
private Bounds gameBoardBounds;
|
||||
@@ -36,6 +38,7 @@ public class MultiplierSpawner : Spawner
|
||||
spawnTimer = 0f;
|
||||
if (Random.value < spawnProbability)
|
||||
{
|
||||
spawnPosition = worldFiller.GetRandomPositionInFreeAreas(multiplierBounds);
|
||||
GameObject multiplier = Instantiate(multiplierPrefab, spawnPosition, Quaternion.identity);
|
||||
isActive = false;
|
||||
}
|
||||
@@ -46,15 +49,5 @@ public class MultiplierSpawner : Spawner
|
||||
{
|
||||
isActive = true;
|
||||
spawnTimer = 0f;
|
||||
spawnPosition = new Vector2(
|
||||
Random.Range(
|
||||
gameBoardBounds.min.x + multiplierBounds.extents.x,
|
||||
gameBoardBounds.max.x - multiplierBounds.extents.x
|
||||
),
|
||||
Random.Range(
|
||||
gameBoardBounds.min.y + multiplierBounds.extents.y,
|
||||
gameBoardBounds.max.y - multiplierBounds.extents.y
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,4 +13,20 @@ public abstract class Spawner : MonoBehaviour
|
||||
{
|
||||
isSpawning = true;
|
||||
}
|
||||
|
||||
protected Vector2 GetRandomSpawnPosition(Bounds bounds)
|
||||
{
|
||||
var spawnPosition = new Vector2(
|
||||
Random.Range(
|
||||
bounds.min.x + bounds.extents.x,
|
||||
bounds.max.x - bounds.extents.x
|
||||
),
|
||||
Random.Range(
|
||||
bounds.min.y + bounds.extents.y,
|
||||
bounds.max.y - bounds.extents.y
|
||||
)
|
||||
);
|
||||
|
||||
return spawnPosition;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user