Exemplo n.º 1
0
 private void MovePlayerToHomeZone(Player player, GameModel game, Form form)
 {
     for (int i = 0; i < 50; i++)
     {
         player.MoveUp(form);
         player.MoveLeft(form);
         game.CheckFlagCapture();
         game.CheckIfFlagIsAtHomeZone();
     }
 }
Exemplo n.º 2
0
        public void Should_ChangePlayerSizeIfFlagIsCaptured()
        {
            var testGame = new GameModel(300, 300, 0, 2);
            var testForm = new CaptureTheFlagMode(testGame);
            var player   = testGame.Players.First();

            player.SetPosition(testGame.Flag.X, testGame.Flag.Y);
            testGame.CheckFlagCapture();

            Assert.AreNotEqual(player.Width, player.OriginalWidth);
            Assert.AreNotEqual(player.Height, player.OriginalHeight);
        }
Exemplo n.º 3
0
        public void Should_ChangePlayerSpeedIfFlagIsCaptured()
        {
            var testGame   = new GameModel(300, 300, 0, 2);
            var testForm   = new CaptureTheFlagMode(testGame);
            var player     = testGame.Players.First();
            var startSpeed = player.Speed;

            player.SetPosition(testGame.Flag.X, testGame.Flag.Y);
            testGame.CheckFlagCapture();

            Assert.AreNotEqual(startSpeed, player.Speed);
        }
Exemplo n.º 4
0
        public void Should_CaptureTheFlag()
        {
            var testGame = new GameModel(300, 300, 0, 2);
            var testForm = new CaptureTheFlagMode(testGame);
            var player   = testGame.Players.First();

            player.SetPosition(testGame.Flag.X, testGame.Flag.Y);
            testGame.CheckFlagCapture();

            Assert.AreEqual(true, player.HasFlag);
            Assert.AreEqual(testGame.Flag.Owner, player);
        }
Exemplo n.º 5
0
        public void Should_SetPlayerSpeedToNormalIfFlagIsAtHomeZone()
        {
            var testGame = new GameModel(100, 100, 0, 2);
            var testForm = new CaptureTheFlagMode(testGame);
            var player   = testGame.Players.First();

            player.SetPosition(testGame.FieldWidth / 2, testGame.FieldHeight / 2);
            testGame.CheckFlagCapture();
            var playerChangedSpeed = player.Speed;

            MovePlayerToHomeZone(player, testGame, testForm);

            Assert.AreNotEqual(player.Speed, playerChangedSpeed);
        }