Пример #1
0
        }// LoadGrid

        void GameContinued()
        {
            const int eDelay = 25;

            _RoundComplete = false;
            _Finish        = false;
            int delay = Globals.gameLoop;

            while (!_Finish)
            {
                CheckKeys();
                Tank.ProjectileCheck res = Tank.Green.CheckProjectile(_Grid);
                res |= Tank.Orange.CheckProjectile(_Grid);

                if ((res & Tank.ProjectileCheck.GreenScore) != 0)
                {
                    delay = eDelay;
                    Tank.Green.Collided();
                }
                if ((res & Tank.ProjectileCheck.OrangeScore) != 0)
                {
                    delay = eDelay;
                    Tank.Orange.Collided();
                }

                ModelPanel.ChangeScreen(_Background, _ModelPanel.Screen);

                _ModelPanel.DoPaint();

                if ((Tank.Green.hasCollided || Tank.Orange.hasCollided) &&
                    Tank.Green.CollisionComplete && Tank.Orange.CollisionComplete)
                {
                    if (Tank.Green.hasCollided)
                    {
                        Tank.OrangeScore++;
                    }
                    else if (Tank.Orange.hasCollided)
                    {
                        Tank.GreenScore++;
                    }

                    _RoundComplete = true;
                    return;
                }    //if


                if (!_Finish)
                {
                    System.Threading.Thread.Sleep(delay);
                }
            } // while
        }     // Continued
Пример #2
0
        void NewGame(string grid)
        {
            EndRound();

            if (_Thread != null)
            {
                _Thread.Abort();
            }

            LoadGrid(grid);
            ModelPanel.CreateGrid(_Grid, _Background);
            ModelPanel.ChangeScreen(_Background, _ModelPanel.Screen);
            _ModelPanel.GameOver = false;

            Tank.GreenScore  = 0;
            Tank.OrangeScore = 0;

            NextRound();
        }// NewGame