|
Hello, can you please give me an example of chain of explosions? I tried with OverlapSphere's but no luck...maybe it's with OverlapSphere but I can't do it... it Creates and Destroys maximum of 2 bombs. How can I make it Explode and Destroy all objects in chain? Something like create OverlapSphere for every Destroyed object or before Destroying. And if there is another object with tag BlockBomb within range of Destroyed/Destroying object. Explode and Destroy object, and so on, or any other way. Please help, here is my code for Bomb:
--- BombExplosion -> Prefab, of my explosion
(comments are locked)
|
|
http://answers.unity3d.com/questions/160959/quotchain-of-explosionsquot-destroying-gameobjects.html I asked this question recently and the solution that worked best was Using SendMessage to call a explosion function on the object. A run down is, so say you have a bomb prefab, each has an overlap sphere which populates an array with all the colliders inside the spheres radius. What you want to do is attach a script to the bomb and make a destroy function that when called iterates through that array and sends the destroy function on those objects. That should do the trick. p.s. as SilverTabby pointed out its probably a good idea to leave a few frames between each destroy call so maybe add a few yields. Here is my script Urgh I cant seem to get the code block to work right...regardless here it is p.s. I removed the bits that wouldnt be relevant and added comments so you can see what everything does. p.p.s sorry its not in java script I work in c# I might be able to translate it if its what you need.
Nov 16 '11 at 07:17 AM
sacredgeometry
lol, I'm C# too, thanks for answer I'll check if it works , if it works I'll mark answer as right.
Nov 16 '11 at 02:33 PM
vozochris
Thanks, Brian 2, this really helped me.
Nov 16 '11 at 03:26 PM
vozochris
(comments are locked)
|
