示例#1
0
        /// <summary>
        /// Resets the game
        /// </summary>
        public void Reset()
        {
            // Clear and reset food and characters
            mMap.ResetFood();
            mCharacters.Clear();

            // Create the player and assign the keyDown event to it
            Player player = new Player(this, Pacman.Properties.Resources.player, mMap.GetRandomPlayerSpawn());

            mCharacters.Add(player);
            mMainForm.KeyDownEvent += player.OnKeyDown;

            // Create enemies
            List <Point> enemySpawns = mMap.GetEnemySpawns();

            for (int i = 0; i < enemySpawns.Count; i++)
            {
                mCharacters.Add(new Enemy(this, Pacman.Properties.Resources.monster, enemySpawns[i]));
            }
        }