Update DifficultyScale for Cap and Slow Ease

This commit is contained in:
Philip W 2021-11-15 17:07:33 +00:00
parent 02d9a4ac37
commit 575388d95e

View File

@ -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<ObjectCreatorArea>().spawnInterval <= difficultyCap) return;
switch (difficultyType)
{
case TypeOfDifficulty.Exponential:
@ -26,14 +28,14 @@ public class DifficultyScale : MonoBehaviour
{
currentDifficultyLevel++;
incrementDifficultyInSeconds += incrementAmountInSeconds;
this.GetComponent<ObjectCreatorArea>().spawnInterval = this.GetComponent<ObjectCreatorArea>().spawnInterval * 0.5f;
this.GetComponent<ObjectCreatorArea>().spawnInterval = this.GetComponent<ObjectCreatorArea>().spawnInterval - 0.5f;
}
break;
case TypeOfDifficulty.Constant:
if ((Mathf.FloorToInt(time.GetComponent<UITimer>().time) >= (incrementDifficultyInSeconds * (currentDifficultyLevel + 1))))
{
currentDifficultyLevel++;
this.GetComponent<ObjectCreatorArea>().spawnInterval = this.GetComponent<ObjectCreatorArea>().spawnInterval * 0.5f;
this.GetComponent<ObjectCreatorArea>().spawnInterval = this.GetComponent<ObjectCreatorArea>().spawnInterval - 0.5f;
}
break;
}