示例#1
0
文件: Game.cs 项目: darkarki83/.NET
        public void LoadGame(Memento m)
        {
            Map           = m.MMap;
            TheSuperPoint = m.MTheSuperPoint;
            ThePoint      = m.MThePoint;

            PacMan.Draw(Map);
            for (int i = 0; i < Monsters.Count; i++)
            {
                Monsters[i].Draw(Map);
            }
            // PacMan.CancelSuperPoint(PacMan, EventArgs.Empty);
            PacMan.Life--;
        }
示例#2
0
文件: Game.cs 项目: darkarki83/.NET
 public void PacManMove()
 {
     ConsoleLib.Coord temp = PacMan.DirectionalCheck();
     Thread.Sleep(100);
     if (Console.KeyAvailable == true)
     {
         PacMan.Move(Map);
     }
     else if (Map.GetPointInMap(temp.y, temp.x) != 1)
     {
         PacMan.DeleteDraw(Map);
         PacMan.SetCoordMonster(temp);
         PacMan.Draw(Map);
     }
 }
示例#3
0
文件: Game.cs 项目: darkarki83/.NET
        public void Play()
        {
            Console.CursorVisible = false;
            Map.Draw(6, 20);
            PacMan.Draw(Map);

            for (int i = 0; i < Monsters.Count; i++)
            {
                Monsters[i].Draw(Map);
            }

            TimerStartGame();
            bool win = false;

            do
            {
                //----------------------------------------------------------------//

                /* for (int i = 0; i < Map.SizeY; i++)
                 * {
                 *   ConsoleLib.GotoXY(80, 6 + i);
                 *   for (int j = 0; j < Map.SizeX; j++)
                 *   {
                 *       Console.Write(Map.GetPointInMap(i, j));
                 *   }
                 * }*/
                //-----------------------------------------------------------------//
                PacManMove();
                if (ExitFromGame == true)
                {
                    break;
                }
                MonsterMove();

                ConsoleLib.GotoXY(1, 1);                                     /// на посмотреть
                Console.WriteLine("point count : {0}", ThePoint.PointCount); // на посмотреть

                ConsoleLib.GotoXY(20, 5);                                    // вывод рекорда на посмотреть
                Console.Write("score :: {0}", PacMan.Score);

                if (ThePoint.PointCount < 3)
                {
                    win = WinCheck();
                }
            } while (((ThePoint.PointCount + TheSuperPoint.SuperPointCount) != 0 || win != true) && PacMan.Life != 0);
        }
示例#4
0
        public void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            DrawBoard(spriteBatch);

            // Draw items
            for (int y = 0; y < TilesHigh; y++)
            {
                for (int x = 0; x < TilesWide; x++)
                {
                    if (_tileItems[x, y] != null)
                    {
                        _tileItems[x, y].Draw(spriteBatch, gameTime);
                    }
                }
            }

#if DEBUG
            if (!HideBlinky)
            {
                DrawGhostDirection(spriteBatch, Blinky);
            }
            if (!HidePinky)
            {
                DrawGhostDirection(spriteBatch, Pinky);
            }
            if (!HideInky)
            {
                DrawGhostDirection(spriteBatch, Inky);
            }
            if (!HideClyde)
            {
                DrawGhostDirection(spriteBatch, Clyde);
            }
#endif

            PacMan.Draw(spriteBatch, gameTime);

            if (!HideBlinky)
            {
                Blinky.Draw(spriteBatch, gameTime);
            }
            if (!HidePinky)
            {
                Pinky.Draw(spriteBatch, gameTime);
            }
            if (!HideInky)
            {
                Inky.Draw(spriteBatch, gameTime);
            }
            if (!HideClyde)
            {
                Clyde.Draw(spriteBatch, gameTime);
            }

            // Fruit
            if (Fruit != null)
            {
                Fruit.Draw(spriteBatch, gameTime);
            }

            // Effects
            for (int i = 0; i < Effects.Count; i++)
            {
                Effects[i].Draw(spriteBatch, gameTime);
            }

            // HUD
            DrawHud(spriteBatch);
        }