private void timer_Tick(object sender, EventArgs e) { if (OnCountDown()) { HourArea.Text = processCount.GetHour(); MinuteArea.Text = processCount.GetMinute(); SecondArea.Text = processCount.GetSecond(); } else //timer.Stop(); { // this.Close(); // MessageBox.Show("Sorry, time is up!>_<!"); Game_over a = new Game_over(); a.ShowDialog(); this.Close(); } }
/// <sumamry> /// Verify if the next down position is reachable /// </summary> public bool verifyNextDown(int x, int y) { //set default value of result is false bool result = false; //define next position: nextPos_X, nextPos_Y int nextPos_X, nextPos_Y; try { nextPos_X = x; nextPos_Y = y + 1; result = posMatrix[nextPos_X, nextPos_Y]; //if (result == false) // MessageBox.Show("That position is unavailable"); if (nextPos_X == 5 && nextPos_Y == 2) { //Win status Game_over a = new Game_over(); this.Close(); a.ShowDialog(); //Monster 2 //if (!showQuesDia) //{ // showQuesDia = true; //Flag to stop the scan of the Kinect // //Record the current second // Lastsecond = int.Parse(processCount.GetSecond()); //} ////Get current second //if (int.Parse(processCount.GetSecond()) - Lastsecond <= 5 && // int.Parse(processCount.GetSecond()) - Lastsecond >= 0 || // Lastsecond - int.Parse(processCount.GetSecond()) <= 5 && // Lastsecond - int.Parse(processCount.GetSecond()) >= 0) //{ // this.KinectSensorManager.KinectSensor.Stop(); // Process aprocess = new Process(); // aprocess.StartInfo.FileName = "E:/Xtian/Carleton School/TIM Program/Winter14/SYSC 5409/Project/Game Code/Full Project/Maze Game - Copy/Obj/GettingStarted/bin/Debug/GettingStarted.exe"; // //this.KinectSensorManager.KinectSensor = null; // aprocess.Start(); // //Start new process for the question section // while (!aprocess.WaitForExit(1000)) ; // aprocess.Close(); // if (this.KinectSensorManager.KinectSensor.IsRunning == false) // //Verify the Status of the Kinect // { // this.KinectSensorManager.KinectSensor.Start(); // //Start a new thread // } //} } } catch { //MessageBox.Show("That position is unavailable"); } return result; }