/** * Sets the level, and level properties */ public void SetLevelProperties(int newLevel, int mode) { //check level if (newLevel <= 0) { print("level is less than 0, by default will set back to 1"); newLevel = 1; } //Set base numenemies left if (mode == LEVEL_MODE) { numEnemiesLeft = 5 + 3 * newLevel; } else if (mode == SURVIVAL_MODE) { numEnemiesLeft = 100000000; } //level dependent attributes asteroidSpeed = 1 + newLevel * 0.2f; //attributes for each level if (newLevel >= 1) { enemyClass.SetWaitTime(4.0f, 5.0f); asteroidClass.SetWaitTime(1.5f, 2.5f); powerupClass.SetWaitTime(5f, 10f); maxAsteroidsSpawnAtTime = 1; maxEnemiesSpawnAtTime = 1; } if (newLevel >= 5) { enemyClass.SetWaitTime(3.0f, 4.0f); asteroidClass.SetWaitTime(1.25f, 2.0f); } if (newLevel >= 7) { enemyClass.SetWaitTime(2.5f, 3.25f); asteroidClass.SetWaitTime(1.25f, 1.75f); maxAsteroidsSpawnAtTime = 2; } if (newLevel >= 10) { enemyClass.SetWaitTime(2.5f, 3.0f); asteroidClass.SetWaitTime(1.0f, 1.5f); powerupClass.SetWaitTime(4.5f, 9f); maxEnemiesSpawnAtTime = 2; } if (newLevel >= 15) { enemyClass.SetWaitTime(2.0f, 2.5f); asteroidClass.SetWaitTime(0.75f, 1.25f); maxAsteroidsSpawnAtTime = 3; } if (newLevel >= 20) { enemyClass.SetWaitTime(1.75f, 2.0f); asteroidClass.SetWaitTime(0.65f, 1.0f); powerupClass.SetWaitTime(4f, 8f); } if (newLevel >= 25) { enemyClass.SetWaitTime(1.5f, 1.75f); asteroidClass.SetWaitTime(0.5f, 0.85f); maxAsteroidsSpawnAtTime = 4; maxEnemiesSpawnAtTime = 3; } StartCoroutine(RecalculateFrequencies(newLevel)); }