Hi friends,
I’m working on a 2D game (from the top down view) where the user lays out waypoints and then presses Go. His unit follows the path, and if it runs into an enemy, it will attack it.
So I have the movement script done, and I’m working on the attack script. For movement, I’m storing the waypoint coordinates in an array and then running a loop which utilizes a Move() function to carry the unit from point to point. I’m using Vector3.Distance to calculate whether or not the unit is in range of attacking the enemy, and if so, running an Attack() function.
How can I include some sort of pause or freezing in this loop, so that the unit momentarily STOPS moving in-between waypoints, runs the Attack(), then continues the movement where he last left off? Any help/suggestions appreciated. Thanks