From 575388d95e277ac73555046793daec3839d89444 Mon Sep 17 00:00:00 2001 From: Philip White Date: Mon, 15 Nov 2021 17:07:33 +0000 Subject: [PATCH] Update DifficultyScale for Cap and Slow Ease --- Unity-Files/Assets/Scripts/Gameplay/DifficultyScale.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Unity-Files/Assets/Scripts/Gameplay/DifficultyScale.cs b/Unity-Files/Assets/Scripts/Gameplay/DifficultyScale.cs index b83beb6..78f723a 100644 --- a/Unity-Files/Assets/Scripts/Gameplay/DifficultyScale.cs +++ b/Unity-Files/Assets/Scripts/Gameplay/DifficultyScale.cs @@ -10,6 +10,7 @@ public class DifficultyScale : MonoBehaviour public TypeOfDifficulty difficultyType; [SerializeField] private int incrementDifficultyInSeconds = 30; [SerializeField] private int incrementAmountInSeconds = 25; + [SerializeField] private float difficultyCap = 0.5f; private int currentDifficultyLevel = 0; public enum TypeOfDifficulty { @@ -19,6 +20,7 @@ public class DifficultyScale : MonoBehaviour // Update is called once per frame void Update() { + if (GetComponent().spawnInterval <= difficultyCap) return; switch (difficultyType) { case TypeOfDifficulty.Exponential: @@ -26,14 +28,14 @@ public class DifficultyScale : MonoBehaviour { currentDifficultyLevel++; incrementDifficultyInSeconds += incrementAmountInSeconds; - this.GetComponent().spawnInterval = this.GetComponent().spawnInterval * 0.5f; + this.GetComponent().spawnInterval = this.GetComponent().spawnInterval - 0.5f; } break; case TypeOfDifficulty.Constant: if ((Mathf.FloorToInt(time.GetComponent().time) >= (incrementDifficultyInSeconds * (currentDifficultyLevel + 1)))) { currentDifficultyLevel++; - this.GetComponent().spawnInterval = this.GetComponent().spawnInterval * 0.5f; + this.GetComponent().spawnInterval = this.GetComponent().spawnInterval - 0.5f; } break; }