예제 #1
0
        public override void Update()
        {
            long now  = Stopwatch.ElapsedMilliseconds;
            long diff = now;

            LastUpdate = now;

            // Check of we window moeten tonen
            if (HasLost)
            {
                if (!lose.Visible)
                {
                    lose.ShowDialog();
                }
                HasLost = false;
            }
            else if (HasWon)
            {
                if (!win.Visible)
                {
                    win.ShowDialog();
                }
                HasWon = false;
            }

            // Model updaten (propageren naar Level object waar meeste logica plaatsvindt)
            if (!gamePaused)
            {
                Level.Update(diff);
            }
            // Alle Views van dit Model updaten
            base.UpdateViews(diff);
        }
예제 #2
0
        // Shortcut keybind to 'P' for pausing and unpausing
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            switch (keyData)
            {
            case Keys.F1:
                if (CBDebugView.Checked)
                {
                    PopupLose lose = new PopupLose(this.Game);
                    lose.ShowDialog();
                }
                return(true);

            case Keys.F2:
                if (CBDebugView.Checked)
                {
                    PopupWin win = new PopupWin(this.Game);
                    win.ShowDialog();
                }
                return(true);

            case Keys.F3:
                if (CBDebugView.Checked)
                {
                    Game.Reset();
                }
                return(true);

            case Keys.P:
                pauseButton.PerformClick();
                return(base.ProcessCmdKey(ref msg, keyData));

            case Keys.N:
                if (CBDebugView.Checked)
                {
                    this.Game.Level.Update(0);
                }
                return(true);

            default:
                return(true);
            }
        }