enemies balanced
This commit is contained in:
parent
e041d2deec
commit
cdacdf23a5
8
Assets/Prefabs/Enemies.meta
Normal file
8
Assets/Prefabs/Enemies.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 149cbd6661128ab4cbf4259ee07fec2a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -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
|
||||
@ -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
|
||||
@ -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
|
||||
2547
Assets/Scenes/test_balancing.unity
Normal file
2547
Assets/Scenes/test_balancing.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Scenes/test_balancing.unity.meta
Normal file
7
Assets/Scenes/test_balancing.unity.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c080f1de6d365744abbb7316aab60231
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -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,26 +23,44 @@ public class SpawnManager : MonoBehaviour
|
||||
private void Update()
|
||||
{
|
||||
elapsedTime += Time.deltaTime;
|
||||
Debug.Log(elapsedTime);
|
||||
}
|
||||
|
||||
|
||||
IEnumerator SpawnNewEnemy()
|
||||
{
|
||||
{
|
||||
while (running)
|
||||
{
|
||||
GameObject spawned = Instantiate(GetRandomEnemy(), GetRandomSpawn().transform.position, Quaternion.identity);
|
||||
|
||||
foreach (Transform trans in spawned.GetComponentsInChildren<Transform>(true))
|
||||
if ((elapsedTime < 30f && dimensionLayer == 7) || elapsedTime > 30f)
|
||||
{
|
||||
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.GetComponent<Enemy>().SetLandingPoint(GetRandomLandingPoint().transform);
|
||||
//TODO: replace 2f by function depending on elapsed time, decreasing waiting time over time
|
||||
yield return new WaitForSeconds(2f);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
GameObject GetRandomEnemy()
|
||||
|
||||
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user