Post by reineinmyheart on Sept 14, 2016 6:15:53 GMT
I'm using coregamekit to spawn my obstacles for my endless runner game. What I wanted is to spawn three normal obstacles before spawning a bonus obstacle. And this would go on forever. I have created several prefabs of obstacle groups, I have some set of normal obstacles, and one set of bonus obstacles(which only has coins). Currently, I set up my level waves this way:
SO, my Level 1 - Wave 1 would only spawn normal obstacles. Then Level 1 - Wave 2 spawns only bonus obstacles.
For this, I created two syncro spawners, one for normal obstacles (that would spawn during Level 1-Wave 1) and the other for bonus obstacles (would spawn during Level 1-Wave2). My Syncro Spawners gets a random obstacle from a prefab pool. I just call PoolBoss.Despawn(obstacle) when an obstacle goes off screen. Min and Max To Spawn are both set to 3. And time to spawn is set to 0. Here's a screenshot of my syncro spawners settings.
NORMAL SYNCRO SPAWNER:
BONUS SYNCRO SPAWNER
Once the player dies, I try to reset the level by calling:
then once player is ready to begin again, I just call LevelSettings.UnpauseWave();
Problems Encountered:
1. However, when the waves begin again, the syncro spawner spawns two obstacles at the beginning. So two obstacles are overlapping each other. It only happens on the first spawn. I can't figure out where it's coming from.
2. I tried debugging using a LevelSettingsListener, but only one wave started.
I also noticed that after the Bonus Wave, there is an empty UNNAMED wave happening before going back to Normal Waves. Is that okay?
Also, the WaveEnded function prints out the current wave instead of the previous wave.
I may have missed out on something, so I need an expert's eye. I hope I have described everything well. Thank you for your help.
SO, my Level 1 - Wave 1 would only spawn normal obstacles. Then Level 1 - Wave 2 spawns only bonus obstacles.
For this, I created two syncro spawners, one for normal obstacles (that would spawn during Level 1-Wave 1) and the other for bonus obstacles (would spawn during Level 1-Wave2). My Syncro Spawners gets a random obstacle from a prefab pool. I just call PoolBoss.Despawn(obstacle) when an obstacle goes off screen. Min and Max To Spawn are both set to 3. And time to spawn is set to 0. Here's a screenshot of my syncro spawners settings.
NORMAL SYNCRO SPAWNER:
BONUS SYNCRO SPAWNER
Once the player dies, I try to reset the level by calling:
PoolBoss.DespawnAllPrefabs();
LevelSettings.GoToWave(1, 1); to go back to first wave.
LevelSettings.PauseWave();
then once player is ready to begin again, I just call LevelSettings.UnpauseWave();
Problems Encountered:
1. However, when the waves begin again, the syncro spawner spawns two obstacles at the beginning. So two obstacles are overlapping each other. It only happens on the first spawn. I can't figure out where it's coming from.
2. I tried debugging using a LevelSettingsListener, but only one wave started.
public override void WaveEnded(LevelWave levelWaveInfo)
{
Debug.Log(levelWaveInfo.waveName + " wave ended.");
}
public override void WaveStarted(LevelWave levelWaveInfo)
{
Debug.Log(levelWaveInfo.waveName + " wave started");
}
public override void WaveEndedEarly(LevelWave levelWaveInfo)
{
Debug.Log(levelWaveInfo.waveName + " ended early");
}
I also noticed that after the Bonus Wave, there is an empty UNNAMED wave happening before going back to Normal Waves. Is that okay?
Also, the WaveEnded function prints out the current wave instead of the previous wave.
I may have missed out on something, so I need an expert's eye. I hope I have described everything well. Thank you for your help.