private void CheckScheduleForBroadcastSwitchover(BroadcastChannel channel) { Broadcast cuedShow = null; Broadcast currentShow = null; bool foundScheduledShow = false; bool foundCurrentShow = false; foreach (Broadcast show in channel.schedule) { if (Time.time > show.startTime && !show.isPlaying && !show.finishedPlaying) { cuedShow = show; foundScheduledShow = true; } if (show.isPlaying) { currentShow = show; foundCurrentShow = true; } } if (foundScheduledShow) { if (foundCurrentShow) { channel.PlayBroadcast(cuedShow); cuedShow.isPlaying = true; channel.ResetBroadcast(currentShow); currentShow.isPlaying = false; currentShow.finishedPlaying = true; } else { if (Time.time > currentShow.startTime + currentShow.duration) { channel.ShowOffAirScreens(); } } } }