public override void OnReceivedMessage(Message message) { switch (message.Route) { case (int)MessageDestination.SIMULATION_PAUSE: { // Pause the timeline timeline.SetPauseState(true); } break; case (int)MessageDestination.SIMULATION_RESUME: { // Pause the timeline timeline.SetPauseState(false); } break; case (int)MessageDestination.SIMULATION_START: { //timeline.Reset(); } break; case (int)MessageDestination.SIMULATION_END: { timeline.ResetTimeline(); } break; case (int)MessageDestination.SCENE_CHANGE: // A Scene change has occurred { if (message.Identifier == "VALID") { SimulationScene scene = (SimulationScene)message.Data; // Get the timeline actions and push them to the timeline List <ITimelineAction> actions = timeline.GetRawActions(); scene.GetActions(actions); string durationStr; if (scene.GetAttribute("DURATION", out durationStr)) { float duration; if (float.TryParse(durationStr, out duration)) { timeline.StartTimeline(duration); } else { Debug.LogWarning("Failed to parse scene duration"); } } else { Debug.LogWarning("Failed to get scene duration"); } } } break; } }