Example #1
0
        public void ShootInPlayer()
        {
            InstanceGenerator.Cleaner(CharacteId1);
            CreateChar(CharacteId1, lobbyId, "Step1");
            CreateChar(CharacteId2, lobbyId, "Step2");

            Lobby newlobby = InstanceGenerator.GenerateTestingLobby(lobbyId);

            _lobbyRepository.Create(newlobby);
            bot.SComm(CharacteId1, Direction.North);
            newlobby = _lobbyRepository.Read(lobbyId);
            Assert.AreEqual(newlobby.Players[1].Health == LobbyRules.Test().PlayerMaxHealth - 1, true);
            Assert.AreEqual(newlobby.Players[0].Guns == LobbyRules.Test().PlayerMaxGuns - 1, true);
        }
Example #2
0
        public void MoveUp()
        {
            InstanceGenerator.Cleaner(CharacteId1);
            CreateChar(CharacteId1, lobbyId, "Step1");
            CreateChar(CharacteId2, lobbyId, "Step2");

            Lobby newlobby = InstanceGenerator.GenerateTestingLobby(lobbyId);

            _lobbyRepository.Create(newlobby);
            bot.StateMachine(_characterRepository.Read(CharacteId1).State, "Вверх", CharacteId1);
            newlobby = _lobbyRepository.Read(lobbyId);
            Assert.AreEqual(newlobby.Players[0].UserCoordinate.X == 2, true);
            Assert.AreEqual(newlobby.Players[0].UserCoordinate.Y == 1, true);
        }
Example #3
0
        public void ReadTest()
        {
            int lobbyId = 1;

            InstanceGenerator.Cleaner(lobbyId);
            var lobby = InstanceGenerator.GenerateTestingLobby(lobbyId);

            LobbyRepository lobbyRepository = new LobbyRepository();

            lobbyRepository.Create(lobby);

            var newLobby = lobbyRepository.Read(lobbyId);

            Assert.AreEqual(lobby.GameId, newLobby.GameId);
            Assert.AreEqual(lobby.Maze[0, 3], newLobby.Maze[0, 3]);
            Assert.AreEqual(lobby.Players.Count, newLobby.Players.Count);
        }
Example #4
0
        public static void StartNewLobby(int playerId)
        {
            var gameid  = _memberRepository.ReadLobbyId(playerId);
            var players = _memberRepository.ReadMemberList(gameid);
            var lobby   = new Lobby(gameid);

            foreach (var p in players)
            {
                var character = _characterRepository.Read(p.UserId);
                var player    = new Player
                {
                    Rotate         = Direction.North,
                    Health         = lobby.Rules.PlayerMaxHealth,
                    TelegramUserId = p.UserId,
                    HeroName       = character.CharacterName
                };
                lobby.Players.Add(player);
            }

            LobbyGenerator.InitializeLobby(lobby);
            _lobbyRepository.Create(lobby);
        }