示例#1
0
        /// <summary>
        /// Constructor of the game main loop.
        /// </summary>
        public GameLoop()
        {
            Content.RootDirectory = "Content";

            _graphics = new GraphicsDeviceManager(this);
            _graphics.PreferredBackBufferWidth = 448;
            _graphics.PreferredBackBufferHeight = 576;
            _graphics.ApplyChanges();

            _ghosts = new Ghost[4];

            _map = new Map(_ghosts);
            _pacman = new Pacman(_map);

            Blinky blinky = new Blinky(_map, _pacman);
            Pinky pinky = new Pinky(_map, _pacman);
            Inky inky = new Inky(_map, _pacman, blinky);
            Clyde clyde = new Clyde(_map, _pacman);

            _ghosts[0] = blinky;
            _ghosts[1] = pinky;
            _ghosts[2] = inky;
            _ghosts[3] = clyde;

            _score = 0;
            _eatingScore = 0;
            _life = 3;
            _level = 1;
            _ready = 60 * 4;
            this.IsMouseVisible = true;

            _isOnHomeScreen = true;
            _homeScreen = new HomeScreen(_score, _highScore);
        }