/// <summary> /// Occurs when the user clicks the new game button. When a new game is created the office /// camera is shown and a user instance is created. This is also a good time to setup the /// Game logic engine which handles the characters and user. The flashlight is also /// initialized. /// </summary> /// <param name="sender">ignored</param> /// <param name="e">ignored</param> private void NewGameImageButton_Click(object sender, EventArgs e) { OfficeForm officeCameraForm = new OfficeForm(); // // Stop the theme music anytime a game starts. // _soundEngine.StopSound(_startMenuThemeMusic); User user = new User() { MaskImage = global::FNAF.Properties.Resources.FreddyMask, CurrentForm = officeCameraForm, LastForm = this }; // // Start the game engine. This is the engine that handles basic game logic such as // when to play certain sounds, randomly moves characters throughout the rooms and // decides when to scare if to scare at all. This will also setup the user/security // guard. // ThreadingEngine.StartThread(new GameEngine(user)); // // Each game requires the flashlight so start the flashlight thread here. // ThreadingEngine.StartThread(new Flashlight()); // // The new game is initialized now start the office camera to begin. // GameEngine.ShowForm(officeCameraForm, this); }
/// <summary> /// Overridden OnLoad Event sets up the form and starts the engines needed for this form /// as well as playing the theme music in a loop. /// </summary> /// <param name="e">Not used, passed down to the base class' OnLoad event handler</param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); // // Start the sound engine here to play the theme mustic. // ThreadingEngine.StartThread(_soundEngine); // // Start the theme mustic for the start menu // _startMenuThemeMusic = _soundEngine.PlaySound( global::FNAF.Properties.Resources.StartMenuThemeMusic, // theme mustic for the menu true // play it in a loop ); }