|
Post by baroquedub on Jul 23, 2017 23:21:14 GMT
Is there an equivalent of TriggeredSpawners' 'Event to Activate: CustomEvent' for TriggeredDespawners?
I have a number of TriggeredSpawners that encompass different sectors of my map. TriggerEnterEvent - starts a wave of enemies I've set StopWhentriggerExit to true to stop propagation when the player moves on to another section of the map (and enters a different TriggeredSpanwer with new enemies) I thought I would use the TriggerExitEvent to fire a CustomEvent in WaveSpawn Bonus&Events (with Use on FirstSpawn ticked) e.g. 'DespawnArea1Enemies'
Then on each Area1Enemy I wanted to place a TriggeredDespawner that would activate on this CustomEvent, and despawn. This is so enemies from a previous area are culled (despawned) after the player moves on to the next area to stop them taking up resources and keep firing etc.
But I can't see a way of doing this 'activation' by CustomEvent.
So instead I'm calling this in the next sector's TriggeredSpawner's WaveStart method (in a listener): PoolBoss.DespawnAllOfPrefab(Area1EnemyPrefab.transform,Area1EnemyPrefab.name); but it means I have to keep a reference of all the spawned enemy gameObjects across all areas. Feels clunky.
Hopefully that makes sense. Any help much appreciated
|
|
|
Post by DarkTonic Dev on Jul 23, 2017 23:59:05 GMT
No, there's really nothing. Possibly these could work:
1) Despawn all of a Pool Boss category? Problem would be that a prefab can only be in one category, but you may want it in different Scenes. Of course you could make a "copy" of that prefab for the other category I suppose. 2) Spawn an invisible HUUUUUGE Killable that's the same layer as your player's weapons, that has 10,000 attack points so it will actually kill everything. But then you'd get the points (World Variable Death Modifiers on the Killables) when you didn't really kill them...
But I think what you really want it on the roadmap:
11) More Custom Events functionality 11a) Add to Killable the ability to take damage / destroy / despawn from custom events.
And you also could just write a quick subclass of ICgkEventReceiver that will call PoolBoss.Despawn(this.Transform) from the method ReceiveEvent after it makes sure that the Custom Event matches what you're listening to. I can write one and include it if you like. It could be CustomEventDespawner.
|
|
|
Post by baroquedub on Jul 25, 2017 23:19:52 GMT
DespawnAllPrefabsInCategory is a great suggestion, thank you! Does exactly what I need until you get to those features on the roadmap.
|
|
|
Post by DarkTonic Dev on Jul 25, 2017 23:23:55 GMT
Awesome, good to hear.
|
|