Adjusted spawning rules

This commit is contained in:
Pasha Bibko
2026-01-15 13:40:46 +00:00
parent c87947075d
commit e77f491d47
3 changed files with 8 additions and 7 deletions

View File

@@ -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();
}
}