The first thing we will do to start off Part 2 of the Wave Spawner is create an IEnumerator that will take an argument type Wave. IEnumerators allow us to wait a set amount of seconds, almost like a pause, when it is called. This is important for spawning our enemies because we made a spawn rate variable that will be that “pause”. IEnumerators need to return a value, so we will use yield break, which return nothing, for now and set the state to the enum of SpawnState.Spawning.

Ryan McCoach

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store