Ejemplo n.º 1
0
        public void TestCurrentDirectionGame()
        {
            Game.Map = Map_creator.CreateMap(@"
WWWWWW
WS   W
W    W
W    W
W    W
WWWWWW", "\n");
            Game.PackMansPosition = new Point(1, 1);
            Game.PacMansDirection = Directions.Right;
            Game.PointsAtLevel    = 7;
            Game.PointsEated      = 2;
            var PacmanPos = new Point(1, 1);
            var pacman    = new PackMan(Directions.Right);

            for (var i = 0; i < 3; i++)
            {
                var a = pacman.Act(PacmanPos.X, PacmanPos.Y);
                PacmanPos.X += a.DeltaX;
                PacmanPos.Y += a.DeltaY;
            }
            pacman.CurrentDirection = Directions.Down;
            for (var i = 0; i < 3; i++)
            {
                var a = pacman.Act(PacmanPos.X, PacmanPos.Y);
                PacmanPos.X += a.DeltaX;
                PacmanPos.Y += a.DeltaY;
            }
            Assert.AreEqual(new Point(4, 4), PacmanPos);
            Assert.AreEqual(Game.PacMansDirection, Directions.Down);
        }
Ejemplo n.º 2
0
        public void TestClashGhost()
        {
            Game.CreateMap(TestGhost.Map);
            var blinky = new Blinky(Directions.Nothing);
            var pacman = new PackMan(Directions.Right);

            Assert.AreEqual(pacman.DeadInConflict(blinky), true);
            Game.IsMonsterStyle = true;
            Assert.AreEqual(pacman.DeadInConflict(blinky), false);
        }