Is there a smarter way to implement event sequencing?

Hi all Unity users,

I’m new to Unity and C# and been trying to get a hang on timing and sequencing using MonoBehavior.Update and Time.delta. I have the following code that chronologically triggers the change of animation at various specific times.

using UnityEngine;
using System;

public class Sequencer: MonoBehaviour 
{

    //Basic flags to indicate actions required by this class
	private bool m_StartPlayed;
	private bool m_FirstPlayed;
	private bool m_SecondPlayed;
	private bool m_ThirdPlayed;
	private bool m_EnderPlayed;
	private float m_TimeIntervalAccum;

    void Start()
	{
		m_StartPlayed = false;
		m_FirstPlayed = false;
		m_SecondPlayed = false;
		m_ThirdPlayed = false;
		m_EnderPlayed = false;
		m_TimeIntervalAccum = 0.0f;
		
		animation.wrapMode = WrapMode.Loop;
		animation.Stop();    	
	}
	
	void Update()
	{
		m_TimeIntervalAccum += Time.deltaTime;
		if(m_TimeIntervalAccum > 1.0f)
		{
			//Perform interval tasks in Update(). This one call WorkOut every 1 sec
			//WorkOut();		
			m_TimeIntervalAccum = 0.0f;
		}
		
		if(Time.time > 0.0 && Time.time  4.0 && Time.time ] 30.0 && Time.time ]] 60.0 && Time.time  63.0)
		{
			if(m_EnderPlayed == false)
			{
				animation.CrossFade("Idle_A3_ShiftLeft", 1.0);
				m_EnderPlayed = true;
			}
		}       	
	}    
}

The above code works as a series of animation cross-fade calls occuring once at a particular time each. I would call it “pulse events” because I am not sure about the correct technical terms. The above implementation looks really amateurish and inflexible as I would need as many bool as number of pulse events. Is there a better way to implement this? I tried looking for information on actual C# delegates and events on google but can’t find one specific to what I have shown here.

Since you already know the amount of time you need between each animation, I would use a coroutine:

http://unity3d.com/support/documentation/ScriptReference/index.Coroutines_26_Yield.html

public class example : MonoBehaviour 
{
    IEnumerator Do() 
    {
      print("Do now");
      yield return new WaitForSeconds(2);
      print("Do 2 seconds later");
    }


IEnumerator Awake() 
{
  yield return StartCoroutine("Do");
  print("Also after 2 seconds");
  print("This is after the Do coroutine has finished execution");
}

}