Hi,
I was just wondering what the best method to increase the amount of enemys the player has to catch (It’s a fishing game) with time?
So as time increasse the amount of enemys will also increase , the only way I can think of is to create a new enemy at each time individually, like at 1 , 3 ,6 seconds etc…
float m_spawnEnemyDelay = 20;
float m_lastEnemySpawn =0;
if ((Time,time - m_lastEnemySpawn) > m_spawnEnemyDelay)
{
m_lastEnemySpawn = Time.time;
doSpawnEnemy();
doReduceSpawnEnemyDelay();
}
or some such
I notice you have a gap of 2 seconds then one of 3 seconds, so I assume you are increasing the gap by 1 each time. I would do it as:
lastTestTime = Time.time;
testGap = 2; // example numbers used
testChangeTime = 0.5;
fishCaught = 0;
fishRequired = 1;
lastSpawnTime = Time.time;
spawnGap = 2;
function Update () {
if (Time.time > lastTestTime + testGap) {
if (fishCaught < fishRequired) {
failFunction();
}
lastTestTime += testGap;
testGap += testChangeTime;
fishRequired ++;
}
if (Time.time > lastSpawnTime + spawnGap) {
Instantiate (enemyPrefab, desired.position, desired.rotation);
lastSpawnTime += spawnGap;
spawnGap ++;
}
}
Edit: Read the original post again. You want the number required to increase, and the number released to increase.