Hello,
I want to have a code that shows information such as: “Wave 1”, then there is a 3-second break and then waves with objects appear, I tried various things and the word “Wave” appears at the same time objects are created, someone knows how should the code look like to achieve this?
Thank you in advance for your help.
The code responsible for displaying wave information:
WaveCounter.gameObject.SetActive(true);
WaveCounter.text = "Wave " + CurrentWaveNumber;
yield return new WaitForSeconds(3f);
WaveCounter.gameObject.SetActive(false);
rest of code:
public IEnumerator WaveControllerCoroutine()
{
while (true)
{
if (OnWaveStarted != null)
OnWaveStarted.Invoke(CurrentWaveNumber);
itemSpawner.Spawning = true;
otherspawner.Spawning = true;
yield return new WaitForSeconds(WaveDuration);
itemSpawner.Spawning = false;
otherspawner.Spawning = false;
yield return new WaitForSeconds(CooldownDuration);
if (OnWaveEnded != null)
OnWaveEnded.Invoke(CurrentWaveNumber);
yield return new WaitForSeconds(BreakDuration);
CurrentWaveNumber += 1;
}
}