|
The foundation for this code is not mine however I have added some elements. I want to be able to target all enemies in the array and then be able to attack them. What do I need to modify or add to this code to do so? Thanks in advance.
(comments are locked)
|
|
Presumably all enemies have some sort of identification variable in them. So you could for/foreach-loop through all of them to find the right one or if you want to attack all of them at once just loop through all the enemies with either of the forementioned loops.
(comments are locked)
|
|
If your enemies have a collider, you should use Physic.OverlapSphere, which returns the an array of colliders at a given radius, so you don't need to look for them with Find anymore. Then, use a loop on that array and decrease the health of each elements. PS : It's not a big deal, but the way you handle countdown in Update is bugging me, take a look at Mathf.Clamp.
(comments are locked)
|
