public static void ProcessActions(RenderTime elapsedTime) { TotalTick += (ulong)elapsedTime.Ticks; outContainer.ProcessDelay(elapsedTime); //update music if (NextSong != null) { MusicFadeTime -= elapsedTime; if (MusicFadeTime.Ticks <= 0) { AudioManager.BGM.Stop(); if (System.IO.File.Exists(NextSong)) { Song = NextSong; AudioManager.BGM.SetBGM(Song); AudioManager.BGM.Play(); NextSong = null; } else { Song = ""; } } else { AudioManager.BGM.SetVolume((float)MusicFadeTime.Ticks / (float)MUSIC_FADE_TOTAL.Ticks); } } //update fade if (CurrentFade != FadeType.None) { FadeTime -= elapsedTime; if (FadeTime.Ticks <= 0) { CurrentFade = FadeType.None; } } //update the player foreach (PlayerSprite player in Players) { player.Process(elapsedTime); } //update Items foreach (ItemAnim item in Items) { item.Process(elapsedTime); } //update Npcs foreach (NpcSprite npc in Npcs) { npc.Process(elapsedTime); } for (int n = (int)EffectPriority.Ground; n <= (int)EffectPriority.Overlay; n++) { for (int i = Effects[(EffectPriority)n].Count - 1; i >= 0; i--) { Effects[(EffectPriority)n][i].Process(elapsedTime); if (Effects[(EffectPriority)n][i].ActionDone) { Effects[(EffectPriority)n].RemoveAt(i); } } } for (int i = Emitters.Count - 1; i >= 0; i--) { Emitters[i].Process(elapsedTime); if (Emitters[i].ActionDone) { Emitters.RemoveAt(i); } } //update the camera, reliant on the player CamOffset = FocusedCharacter.TileOffset; }