Beispiel #1
0
 private void WaitForPlayerTask()
 {
     while (!_isGameWindowClosed)
     {
         if (_taskTurn)
         {
             Vector2i zug = _game.Player.Play(_game.Field);
             _game.Logik(zug);
             _taskTurn = false;
         }
     }
 }
Beispiel #2
0
        private void Loop()
        {
            Stopwatch st = new Stopwatch();

            st.Start();
            TimeSpan elapsed = TimeSpan.Zero;

            while (true)
            {
                if (elapsed.Seconds != st.Elapsed.Seconds && st.Elapsed.Seconds % _config.PlayVelocity / 2 == 0)
                {
                    game.Logik();
                    if (game.HasEnd())
                    {
                        game.NewGame();
                    }
                }
                else if (st.Elapsed.Milliseconds % 41 == 0)
                {
                    pictureBox1.Invoke(new MethodInvoker(UpdateImageLocation));
                }
                elapsed = st.Elapsed;
            }
        }