enemies balanced

This commit is contained in:
louishorlaville 2022-05-15 14:51:34 -04:00
parent e041d2deec
commit cdacdf23a5
11 changed files with 2626 additions and 18 deletions

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 149cbd6661128ab4cbf4259ee07fec2a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -567,7 +567,7 @@ MonoBehaviour:
explosionDebris: {fileID: 6704497973935827627} explosionDebris: {fileID: 6704497973935827627}
landingPoint: {fileID: 0} landingPoint: {fileID: 0}
body: {fileID: 4916962407531476031} body: {fileID: 4916962407531476031}
flyingSpeed: 50 flyingSpeed: 15
collider: {fileID: 774736357024529276} collider: {fileID: 774736357024529276}
maxHP: 1 maxHP: 1
damage: 1 damage: 1

View File

@ -266,7 +266,7 @@ MonoBehaviour:
explosionDebris: {fileID: 1932237231617645871} explosionDebris: {fileID: 1932237231617645871}
landingPoint: {fileID: 0} landingPoint: {fileID: 0}
body: {fileID: 6601239271941144557} body: {fileID: 6601239271941144557}
flyingSpeed: 50 flyingSpeed: 15
collider: {fileID: 1871861664620959488} collider: {fileID: 1871861664620959488}
maxHP: 2 maxHP: 2
damage: 1 damage: 1

View File

@ -11059,7 +11059,7 @@ MonoBehaviour:
explosionDebris: {fileID: 8307756088670856960} explosionDebris: {fileID: 8307756088670856960}
landingPoint: {fileID: 0} landingPoint: {fileID: 0}
body: {fileID: 3605108994955462082} body: {fileID: 3605108994955462082}
flyingSpeed: 50 flyingSpeed: 10
collider: {fileID: 8097907429543341359} collider: {fileID: 8097907429543341359}
maxHP: 1 maxHP: 1
damage: 1 damage: 1

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c080f1de6d365744abbb7316aab60231
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -8,6 +8,8 @@ public class SpawnManager : MonoBehaviour
public Transform[] spawnPoints; public Transform[] spawnPoints;
public GameObject[] landingPoints; public GameObject[] landingPoints;
public bool running = true; public bool running = true;
public int spawnRateOvertime;
public int dimensionLayer;
float elapsedTime; float elapsedTime;
private int lastSpawn = -1; private int lastSpawn = -1;
@ -21,26 +23,44 @@ public class SpawnManager : MonoBehaviour
private void Update() private void Update()
{ {
elapsedTime += Time.deltaTime; elapsedTime += Time.deltaTime;
Debug.Log(elapsedTime);
} }
IEnumerator SpawnNewEnemy() IEnumerator SpawnNewEnemy()
{ {
while (running) while (running)
{ {
GameObject spawned = Instantiate(GetRandomEnemy(), GetRandomSpawn().transform.position, Quaternion.identity); if ((elapsedTime < 30f && dimensionLayer == 7) || elapsedTime > 30f)
foreach (Transform trans in spawned.GetComponentsInChildren<Transform>(true))
{ {
trans.gameObject.layer = gameObject.layer; GameObject spawned = Instantiate(GetRandomEnemy(), GetRandomSpawn().transform.position, Quaternion.identity);
} foreach (Transform trans in spawned.GetComponentsInChildren<Transform>(true))
{
trans.gameObject.layer = gameObject.layer;
}
spawned.layer = gameObject.layer; spawned.layer = gameObject.layer;
spawned.GetComponent<Enemy>().SetLandingPoint(GetRandomLandingPoint().transform); spawned.GetComponent<Enemy>().SetLandingPoint(GetRandomLandingPoint().transform);
//TODO: replace 2f by function depending on elapsed time, decreasing waiting time over time //TODO: replace 2f by function depending on elapsed time, decreasing waiting time over time
yield return new WaitForSeconds(2f); float waitTime = (((-1 / 10000) * Mathf.Pow(elapsedTime, 2)) + 4);
if (waitTime > .5f)
{
yield return new WaitForSeconds(waitTime);
}
else
{
yield return new WaitForSeconds(0.5f);
}
}
else
{
yield return new WaitForSeconds(2f);
}
} }
} }
GameObject GetRandomEnemy() GameObject GetRandomEnemy()