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}
landingPoint: {fileID: 0}
body: {fileID: 4916962407531476031}
flyingSpeed: 50
flyingSpeed: 15
collider: {fileID: 774736357024529276}
maxHP: 1
damage: 1

View File

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

View File

@ -11059,7 +11059,7 @@ MonoBehaviour:
explosionDebris: {fileID: 8307756088670856960}
landingPoint: {fileID: 0}
body: {fileID: 3605108994955462082}
flyingSpeed: 50
flyingSpeed: 10
collider: {fileID: 8097907429543341359}
maxHP: 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 GameObject[] landingPoints;
public bool running = true;
public int spawnRateOvertime;
public int dimensionLayer;
float elapsedTime;
private int lastSpawn = -1;
@ -21,15 +23,17 @@ public class SpawnManager : MonoBehaviour
private void Update()
{
elapsedTime += Time.deltaTime;
Debug.Log(elapsedTime);
}
IEnumerator SpawnNewEnemy()
{
while (running)
{
if ((elapsedTime < 30f && dimensionLayer == 7) || elapsedTime > 30f)
{
GameObject spawned = Instantiate(GetRandomEnemy(), GetRandomSpawn().transform.position, Quaternion.identity);
foreach (Transform trans in spawned.GetComponentsInChildren<Transform>(true))
{
trans.gameObject.layer = gameObject.layer;
@ -38,8 +42,24 @@ public class SpawnManager : MonoBehaviour
spawned.layer = gameObject.layer;
spawned.GetComponent<Enemy>().SetLandingPoint(GetRandomLandingPoint().transform);
//TODO: replace 2f by function depending on elapsed time, decreasing waiting time over time
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);
}
}
}