From d6ee4f477a58b416c92e404c86c3da94875c06e3 Mon Sep 17 00:00:00 2001 From: BOT Alex <44818698+MagicBOTAlex@users.noreply.github.com> Date: Sun, 4 Feb 2024 07:16:08 +0100 Subject: [PATCH] A nice amount of difficulty increase --- Assets/Scripts/Controller/EnemySpawner/EnemySpawner.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Assets/Scripts/Controller/EnemySpawner/EnemySpawner.cs b/Assets/Scripts/Controller/EnemySpawner/EnemySpawner.cs index ba19bdb..af02df7 100644 --- a/Assets/Scripts/Controller/EnemySpawner/EnemySpawner.cs +++ b/Assets/Scripts/Controller/EnemySpawner/EnemySpawner.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; +using Unity.Mathematics; using Unity.VisualScripting; using UnityEngine; using UnityEngine.AI; @@ -16,8 +17,7 @@ public class EnemySpawner : MonoBehaviour public float difficulty = 1f; // Inspector - [SerializeField] private float difficultyIncreasePerWave = 0.1f; - [SerializeField] private float difficultyMultiplyDecreasePerWave = 0.1f; + [SerializeField] private float difficultyIncreasePerWave = 1f; [SerializeField] private float WaveTime = 20f; [SerializeField] private List enemyDifficulties; [SerializeField] private float SpawnRadius = 10; @@ -61,11 +61,7 @@ public class EnemySpawner : MonoBehaviour SpawnWave(difficulty); Wave++; - if (difficultyIncreasePerWave > 1f) - { - difficultyIncreasePerWave -= difficultyMultiplyDecreasePerWave; - difficulty *= difficultyIncreasePerWave + 1; - } + difficulty *= MathF.Cbrt(difficultyIncreasePerWave); nextWaveRequested = false; timer = 0; }