예제 #1
0
 int StepI  = 0;                                 //Var To Step Shoot Toly
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     PhysicsTimer.Stop();                         //Close Thread Because Window Closed
     JumpTimerM.Stop();                           //Close Thread Because Window Closed
     JumpTimerT.Stop();                           //Close Thread Because Window Closed
     RightTimerM.Stop();                          //Close Thread Because Window Closed
     RightTimerT.Stop();                          //Close Thread Because Window Closed
     LeftTimerT.Stop();                           //Close Thread Because Window Closed
     LeftTimerM.Stop();                           //Close Thread Because Window Closed
     WE.Stop();                                   //Close Thread Because Window Closed
 }
예제 #2
0
 private void media_MediaEnded(object sender, RoutedEventArgs e)
 {
     WE.Stop();
     WE.Play();
 }
예제 #3
0
        private void Window_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Right)
            {
                RightTimerM.Start();
            }
            if (e.Key == Key.Left)
            {
                LeftTimerM.Start();
            }
            if (e.Key == Key.Up || e.Key == Key.Space && CanJumpM)
            {
                JumpTimerM.Start();
            }
            if (e.Key == Key.Escape)
            {
                if (PhysicsTimer.IsEnabled == false)
                {
                    PhysicsTimer.Start();
                    lblEsc.Content    = "Oops ;(";
                    PressM.Visibility = Visibility.Visible;
                    PressT.Visibility = Visibility.Visible;
                    Canvas.SetLeft(PressM, Canvas.GetLeft(Margalit) - 25);
                    Canvas.SetTop(PressM, Canvas.GetTop(Margalit) - 40);

                    Canvas.SetLeft(PressT, Canvas.GetLeft(Toly) - 70);
                    Canvas.SetTop(PressT, Canvas.GetTop(Toly) - 60);

                    MoveLbl = true;
                    WE.Stop();
                }
            }
            if (start)
            {
                if (shootM == false)
                {
                    if (e.Key == Key.Enter)
                    {
                        shootM = true;
                        Canvas.SetTop(Algo, Canvas.GetTop(Margalit));
                        Canvas.SetLeft(Algo, Canvas.GetLeft(Margalit));
                    }
                }
                if (shootT == false)
                {
                    if (e.Key == Key.G)
                    {
                        StepI++;
                        shootT = true;
                        Canvas.SetTop(Step, Canvas.GetTop(Toly));
                        Canvas.SetLeft(Step, Canvas.GetLeft(Toly));
                    }
                }
            }
            if (e.Key == Key.A)
            {
                LeftTimerT.Start();
            }
            if (e.Key == Key.D)
            {
                RightTimerT.Start();
            }
            if (e.Key == Key.W && CanJumpT)
            {
                JumpTimerT.Start();
            }
        }