protected void SendDestroyEvent(SceneEventArgs e) { if (OnDestroyEvent != null) { OnDestroyEvent(this, e); } }
protected void SendLoadEvent(SceneEventArgs e) { if (OnLoadEvent != null) { OnLoadEvent(this, e); } }
//Unload content //Can do audio.play etc public void OnDestroyScene(object sender, SceneEventArgs e) { //Console.Write("EXIT: " + e.Name + "\n"); switch (e.Name) { case "Menu": //MediaPlayer.Stop(); widgetManager.DestroyWidget(widgetManager.Menu); menuContents.UnloadContents(); break; case "Level": //MediaPlayer.Stop(); widgetManager.DestroyWidget(widgetManager.LevelHUD); levelContents.UnloadContents(); break; case "EndScreen": widgetManager.DestroyWidget(widgetManager.EndScreen); endScreenContents.UnloadContents(); break; default: break; } }
protected void SendCreateEvent(SceneEventArgs e) { if (OnCreateEvent != null) { OnCreateEvent(this, e); } }
//Load content, create widget (2D stuff), Setup keyBinding public void OnLoadScene(object sender, SceneEventArgs e) { switch (e.Name) { case "Menu": menuContents.LoadContents(); widgetManager.CreateMenuWidgets(); SetMenuKeyBinding(); MediaPlayer.Play(menuContents.BackgroundMusic); break; case "Level": levelContents.LoadContents(); widgetManager.CreateLevelWidgets(); SetLevelKeyBinding(); MediaPlayer.Play(levelContents.BackgroundMusic); break; case "EndScreen": endScreenContents.LoadContents(); widgetManager.CreateEndScreenWidgets(); scoreManager.UpdateLeaderBoard(); SetEndScreenKeyBinding(); MediaPlayer.Play(endScreenContents.BackgroundMusic); break; default: break; } }