Added Difficulty Scaling Script and Functionality
This commit is contained in:
parent
19738eb168
commit
c38f092ed6
15
Unity-Files/Assets/Examples/Defender/Defender.unity
generated
15
Unity-Files/Assets/Examples/Defender/Defender.unity
generated
@ -2278,6 +2278,7 @@ GameObject:
|
||||
- component: {fileID: 1011785960}
|
||||
- component: {fileID: 1011785961}
|
||||
- component: {fileID: 1011785962}
|
||||
- component: {fileID: 1011785963}
|
||||
m_Layer: 0
|
||||
m_Name: EnemySpawner
|
||||
m_TagString: Untagged
|
||||
@ -2340,6 +2341,20 @@ BoxCollider2D:
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 12, y: 2}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!114 &1011785963
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1011785959}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 9418145f40ecef5499e1656dd4d6a266, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
time: {fileID: 542591968}
|
||||
difficultyScaleInSeconds: 30
|
||||
--- !u!1 &1019999843
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
26
Unity-Files/Assets/Scripts/Gameplay/DifficultyScale.cs
Normal file
26
Unity-Files/Assets/Scripts/Gameplay/DifficultyScale.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DifficultyScale : MonoBehaviour
|
||||
{
|
||||
public GameObject time;
|
||||
[SerializeField] private int difficultyScaleInSeconds = 30;
|
||||
private int nextDifficultyLevel = 2;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if ((Mathf.FloorToInt(time.GetComponent<UITimer>().time) / difficultyScaleInSeconds) + 1 == nextDifficultyLevel)
|
||||
{
|
||||
nextDifficultyLevel++;
|
||||
this.GetComponent<ObjectCreatorArea>().spawnInterval = this.GetComponent<ObjectCreatorArea>().spawnInterval * 0.5f;
|
||||
}
|
||||
}
|
||||
}
|
11
Unity-Files/Assets/Scripts/Gameplay/DifficultyScale.cs.meta
generated
Normal file
11
Unity-Files/Assets/Scripts/Gameplay/DifficultyScale.cs.meta
generated
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9418145f40ecef5499e1656dd4d6a266
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
x
Reference in New Issue
Block a user