Waiting for a method to signal it is done before launching it again

I am making a visualization in C# where there are a lot of gamemove related ‘actions’. An action can be ‘walk to’, ‘say to’ or ‘pick up’ etc etc. If the story I want to visualize goes like this for example:

  • Player walks to NPC1.
  • Player says to NPC1.

In this case i obviously want the first action (sentence) to be completed before starting the second one. My code looks as follows:

void Update () {
	parseScenario ();

The definition for the parseScenario function is the following: (small theoretical background (since the implementation is a bit different): entry is a list which contains a number of gamemoves (sentences) to complete. Look at this like a parent list, since each of these lists can contain a number of other gamemoves (sentences) to complete, this is indicated by a _next field which is the next one to do)

public void parseScenario () {
	foreach (string e in entry) {

The parseEntryLine method looks like this:

public void parseEntryLine (string gm_label) {
	currentGM = findGameMoveByLabel (gm_label);
	if (currentGM.isBrick ()) {
		//Interprete it and perform the animation for it

		//Check if it has a next
		if (currentGM._next != null) {
			parseEntryLine (currentGM._next);

And the animateExpr method is just a function which contains a really big switch statement. Based on what the contents of the ‘action verb’ is, I start a method which performs the action in here.

Now the problem is that obviously when I run it like this the entire story just gets executed immediately.

I cannot figure out how to wait for an action to complete before starting a new one.
Please note that these actions do not have a fixed timespan. (Some require input from the player as well).

I hope the question is clear, if not please ask me to make it more clear.

You would typically do this in one of several ways. Listed in my order of preference.

  • Using a coroutine. Simply yield every frame until the task is done
  • Using a call back. Pass the method a delegate to call when it is completed
  • Using bool checking. Set a bool as a flag to identify when each task is done