|
Post by mimminito on Sept 20, 2018 17:45:10 GMT
I have a single level setup with one wave and one spawner. They are configured as elimination and to repeat endless. I have a use case where a spawned item is not destroyed but I need to move onto the next repeated wave, and I need to trigger this via code. How should I go about this?
|
|
DarkTonic Dev
Administrator
Posts: 4,382
Posts: 4,382
Member is Online
|
Post by DarkTonic Dev on Sept 20, 2018 17:50:27 GMT
|
|
|
Post by mimminito on Sept 20, 2018 18:23:43 GMT
Forgot to mention I had tried this. It triggers a game over event for me when I call EndWave, which it should not.
|
|
DarkTonic Dev
Administrator
Posts: 4,382
Posts: 4,382
Member is Online
|
Post by DarkTonic Dev on Sept 20, 2018 18:34:47 GMT
Actually, it *should* trigger game over. That's because you don't have any other waves or levels (you said you just have one), so the game is over.
What I don't understand is what you think the "next" wave is if you only have one? EndWave ends the wave, including all repeats.
|
|
|
Post by mimminito on Sept 20, 2018 18:45:51 GMT
Sure, that does sound correct. So I am trying to trigger a wave "repeat" via code, instead of via all items eliminated. Is that possible?
|
|
DarkTonic Dev
Administrator
Posts: 4,382
Posts: 4,382
Member is Online
|
Post by DarkTonic Dev on Sept 20, 2018 19:23:10 GMT
Not exactly. You can use LevelSettings.RestartCurrentWave().
It will unfortunately probably reset back to zero any changes to wave size and duration from Spawn Increase and Time Increase settings, if you're using them. Those fields appear in the Repeat Wave section on the Spawner.
|
|
DarkTonic Dev
Administrator
Posts: 4,382
Posts: 4,382
Member is Online
|
Post by DarkTonic Dev on Sept 20, 2018 19:25:53 GMT
You also could just destroy any leftover undestroyed spawns and it will trigger the next wave automatically.
If you're spawning a single prefab type, use Pool Boss API. If it's many (Prefab Pool), you can get all the remaining spawns from the Spawner itself with .SpawnedWaveMembers property and despawn all of them.
|
|
|
Post by mimminito on Sept 21, 2018 8:24:43 GMT
Ok thanks. The issue is that the game has a couple of states for triggering the repeat of a wave. The first being all spawned items are destroyed, the second is if another action occurs then it needs to trigger the next repeat.
|
|
DarkTonic Dev
Administrator
Posts: 4,382
Posts: 4,382
Member is Online
|
Post by DarkTonic Dev on Sept 21, 2018 15:04:14 GMT
Probably easiest to just destroy the Killables still spawned via Pool Boss API.
|
|