You don't technically need a coroutine. The coroutine allows the WaitForMessage(DeductGemsFinished) command to start. Otherwise SendMessage(DeductGems,,MessageManager) will run DeductGems(), which will call Sequencer.Message("DeductGemsFinished") before sequence has even started the WaitForMessage(DeductGemsFinished) command. You probably could have reordered your sequence like this:
Code: Select all
WaitForMessage(DeductGemsFinished);
SendMessage(DeductGems,,MessageManager)
and removed the coroutine. Then WaitForMessage will have started (and will be waiting for "DeductGemsFinished") before SendMessage runs DeductGems().
But, in practice, many times you will use a coroutine when you're using WaitForMessage because it will probably be waiting for some amount of time. The coroutine allows Unity to keep running while your C# method is active.