Adjusted spawning rules
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Ext.B83.Unity.Attributes;
|
||||
using UnityEngine;
|
||||
using Random = UnityEngine.Random;
|
||||
@@ -23,6 +22,7 @@ namespace InterfaceOff
|
||||
private int TotalSpawnWeight { get; set; }
|
||||
|
||||
[field: SerializeField] public bool AutoSpawn { get; private set; } = true;
|
||||
private int SpawnCounter { get; set; }
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@@ -87,10 +87,11 @@ namespace InterfaceOff
|
||||
{
|
||||
if (AutoSpawn)
|
||||
{
|
||||
/* Checks if it should spawn a window */
|
||||
bool shouldSpawn = Random.Range(0, 60) == 0;
|
||||
if (shouldSpawn)
|
||||
/* Decreases the spawn counter and spawns if at 0 */
|
||||
SpawnCounter = Math.Max(0, SpawnCounter - 1);
|
||||
if (SpawnCounter == 0)
|
||||
{
|
||||
SpawnCounter = Random.Range(0, 4 * 20);
|
||||
SpawnNewRandomWindow();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user