Hi ch1ky3n,
Thanks for your ideas.
Yes, the drone is a prefab. I set up the array deadDrone just as a way of being able to sort out drones that are still alive, as I need to be able to send events to the drones, telling them what to target - the mothership or the playership.
I have no particular reason for transferring the prefab to the array, rather than a bool or string, it's just my limitations of understanding.
In a nutshell, I'm trying to set up a little wave manager; one 'squad' starts out as a pooled prefab which consists of one parent containing up to 10 empty game objects arranged in a pattern. At GO, the children of the parent are put into an array, and used as spawn points, then, the FSM runs through the array and spawns a Drone (pooled prefab) at these points.
The drones stay as children, in formation, and the Parent (squad spawner) has a simple Move Towards action to target the mothership.
If the 'squad' of drones comes within range of the mothership, they all peel away one by one from their position; being de-parented, and using Look At Smooth, Apply Force, rigid body physics engine etc, and attack the mothership.
However, if the 'squad' of drones is intercepted by your player spaceship and attacked, the drones all spread out (subtle Explosion action), are de-parented, and now target your play spaceship and attack you.
After 10 seconds of attacking you (player), they turn their attention back to the mothership and swoop away.
You can chase them again, and when you shoot one, just before de-spawn the drone sends an event to all alive drones to turn their attention back to the player.
Does that make sense? I'm trying to establish a simple comms system between the drones, so an event can be sent to either target the mothership, or target the player.
Once all the drones of that wave are destroyed, the squad spawner is de-spawned.
So, maybe I'm over thinking this? Essentially, I want to create a dynamic list of the
alive drones (pooled Prefab) that can receive a Send Event.
On this thread I posted a couple of days ago, there are some screen grabs of the set-up. It's relating to a different issue (solved) but it'll give you a clearer idea:
https://hutonggames.com/playmakerforum/index.php?topic=23425.0I hope that makes sense?
Thanks.