I adopted using the Better Waypoint Follower script from here (Smooth Waypoint Follower Script).
I really like the fact that you can adjust speeds and invoke methods at waypoints using this. Plus also seeing the full track on the scene view really helps me with timing of attacks in my design.
To instantiate waves I animated a wave like Rick suggested, but I added a blank game object called Wave Generator with the following Waves.cs script.
public class Waves : MonoBehaviour {
[SerializeField] GameObject[] waves; // creates a wave based on the wave prefab's position and rotation private void CreateWave(int waveNumber) { GameObject myWave = waves[waveNumber]; Instantiate(myWave, myWave.transform.position, myWave.transform.rotation); } // Generate Wave #1 public void Wave01() { CreateWave(0); }
}
In the Wave Generator I add the prefabs of my waves into the array then call the particular wave method when needed. It works great and allows me to keep using the features of the Better Waypoint class. Eventually I will probably overload CreateWave to accept a different position and rotation then what is in the wave prefab. That way I can create waves in code at any point in the game.
The one drawback I see is that it looks like invoking methods with the Better Waypoint script does not allow me to designate parameters of any method calls. This is why I needed to make a method to call each individual wave with the parameters already set. Hmmm… sounds like a feature I may be able to add to Zaneris;s script…