Adjusted spawning rules
This commit is contained in:
@@ -24,8 +24,8 @@ namespace InterfaceOff
|
||||
{
|
||||
Rect rect = Instance.GameCanvas.pixelRect;
|
||||
|
||||
float x = Random.Range(rect.xMin + 150, rect.xMax - 150);
|
||||
float y = Random.Range(rect.yMin + 150, rect.yMax - 150);
|
||||
float x = Random.Range(rect.xMin, rect.xMax);
|
||||
float y = Random.Range(rect.yMin, rect.yMax);
|
||||
|
||||
return new Vector3(x, y, 0f);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace InterfaceOff
|
||||
);
|
||||
}
|
||||
|
||||
Components.RectTransform.anchoredPosition = position; // Updates position if it is supposed to] change
|
||||
Components.RectTransform.anchoredPosition = position; // Updates position if it is supposed to change
|
||||
}
|
||||
|
||||
public virtual void OnWindowInstantiation() { }
|
||||
|
||||
@@ -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