diff --git a/Unity-Files/Assets/Examples/Defender/Defender.unity b/Unity-Files/Assets/Examples/Defender/Defender.unity index 420208a..e8a9169 100644 --- a/Unity-Files/Assets/Examples/Defender/Defender.unity +++ b/Unity-Files/Assets/Examples/Defender/Defender.unity @@ -2568,6 +2568,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: time: {fileID: 542591968} + difficultyType: 1 incrementDifficultyInSeconds: 30 incrementAmountInSeconds: 25 --- !u!1 &1019999843 diff --git a/Unity-Files/Assets/Examples/Defender/Pastie.prefab b/Unity-Files/Assets/Examples/Defender/Pastie.prefab index bfe43ed..f1eecea 100644 --- a/Unity-Files/Assets/Examples/Defender/Pastie.prefab +++ b/Unity-Files/Assets/Examples/Defender/Pastie.prefab @@ -148,7 +148,7 @@ SortingGroup: m_Enabled: 1 m_SortingLayerID: 0 m_SortingLayer: 0 - m_SortingOrder: -6 + m_SortingOrder: 1 --- !u!1 &8759752071964469198 GameObject: m_ObjectHideFlags: 0 diff --git a/Unity-Files/Assets/Scripts/Gameplay/DifficultyScale.cs b/Unity-Files/Assets/Scripts/Gameplay/DifficultyScale.cs index 336377a..b83beb6 100644 --- a/Unity-Files/Assets/Scripts/Gameplay/DifficultyScale.cs +++ b/Unity-Files/Assets/Scripts/Gameplay/DifficultyScale.cs @@ -2,27 +2,40 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; + + public class DifficultyScale : MonoBehaviour { public GameObject time; + public TypeOfDifficulty difficultyType; [SerializeField] private int incrementDifficultyInSeconds = 30; [SerializeField] private int incrementAmountInSeconds = 25; private int currentDifficultyLevel = 0; - - // Start is called before the first frame update - void Start() + public enum TypeOfDifficulty { - + Exponential, + Constant } - // Update is called once per frame void Update() { - if (((Mathf.FloorToInt(time.GetComponent().time) - (incrementAmountInSeconds * currentDifficultyLevel)) / incrementDifficultyInSeconds) == 1) + switch (difficultyType) { - currentDifficultyLevel++; - incrementDifficultyInSeconds += incrementAmountInSeconds; - this.GetComponent().spawnInterval = this.GetComponent().spawnInterval * 0.5f; + case TypeOfDifficulty.Exponential: + if (((Mathf.FloorToInt(time.GetComponent().time) - (incrementAmountInSeconds * currentDifficultyLevel)) / incrementDifficultyInSeconds) == 1) + { + currentDifficultyLevel++; + incrementDifficultyInSeconds += incrementAmountInSeconds; + 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; + } + break; } } }