From 84cb62559ad3a6d6b333a6cb604f0b137827b73a Mon Sep 17 00:00:00 2001 From: Piegames <14054505+piegamesde@users.noreply.github.com> Date: Tue, 24 Apr 2018 02:16:44 +0200 Subject: [PATCH] Balancing --- Assets/Scripts/Generation/DungeonGenerator.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/Generation/DungeonGenerator.cs b/Assets/Scripts/Generation/DungeonGenerator.cs index 8abf092..e3de152 100644 --- a/Assets/Scripts/Generation/DungeonGenerator.cs +++ b/Assets/Scripts/Generation/DungeonGenerator.cs @@ -434,12 +434,17 @@ public class DungeonGenerator { continue; } float prob2 = 0.04f; - if (UnityEngine.Random.value > 1 - prob2) + if (UnityEngine.Random.value > 1 - prob2 + && x != r.bounds.x + && x != r.bounds.x + r.bounds.width + && y != r.bounds.y + && y != r.bounds.y + r.bounds.height) { r.spawnpoints.Add(pos); } } } + Debug.Log(r.GetCenter() + " " + r.spawnpoints.Count + " spawn points."); } public static void GenerateObjective(Room r) { @@ -452,7 +457,7 @@ public class DungeonGenerator { case 0: { // Scorpion Attack!!!!: List lg = new List(); - int count = UnityEngine.Random.Range(1, ( int ) Mathf.Floor(r.GetSpawnpoints().Count / 2)); + int count = UnityEngine.Random.Range(1, ( int ) Math.Min(Mathf.Floor(r.GetSpawnpoints().Count), 5)); for ( int c = 0; c < count; c++ ) { lg.Add(enemyPrefabs[Entity.Entities.SCORPION]); } @@ -463,7 +468,7 @@ public class DungeonGenerator { case 1: { // Bug Attack!!!!: List lg = new List(); - int count = UnityEngine.Random.Range(1, ( int ) Mathf.Floor(r.GetSpawnpoints().Count / 2)); + int count = UnityEngine.Random.Range(1, ( int ) Math.Min(Mathf.Floor(r.GetSpawnpoints().Count), 10)); for ( int c = 0; c < count; c++ ) { lg.Add(enemyPrefabs[Entity.Entities.BUG]); } @@ -474,7 +479,7 @@ public class DungeonGenerator { case 2: { // Coins!!!!: List lg = new List(); - int count = UnityEngine.Random.Range(1, (int) Mathf.Floor(r.GetSpawnpoints().Count / 2)); + int count = UnityEngine.Random.Range(1, (int) Math.Min(Mathf.Floor(r.GetSpawnpoints().Count), 20)); for ( int c = 0; c < count; c++ ) { lg.Add(enemyPrefabs[Entity.Entities.COIN]); }