public void TestPlayersManagerRemovePlayer() { PlayersManager.ClearPlayers(); Player player1 = new Player(); Player player2 = new Player(); Player player3 = new Player(); PlayersManager.AddPlayer(player1); PlayersManager.AddPlayer(player2); PlayersManager.AddPlayer(player3); PlayersManager.RemovePlayer(player2); System.Collections.ObjectModel.ReadOnlyCollection <Player> players = PlayersManager.GetPlayers(); Assert.AreEqual(2, players.Count); Assert.AreEqual(player1, players[0]); Assert.AreEqual(player3, players[1]); }
public void Disconnect() { // This check and this variable is needed, because unity is not Closing instantly on Application.Quit(); if (!IsConnected) { return; } IsConnected = false; tcpConnection.tcpClient.Close(); tcpConnection = null; udpConnection.CloseConnection(); udpConnection = null; scenesManager.SwitchScene(Scene.MainMenu); playersManager.ClearPlayers(); Logger.LogEvent(LoggerSection.Connection, "Disconnected from the server"); }
public void TestPlayersManagerCreation() { PlayersManager.ClearPlayers(); Assert.AreEqual(0, PlayersManager.GetPlayers().Count); }
public void TestPlayersManagerCreation() { PlayersManager.ClearPlayers(); Assert.IsTrue(PlayersManager.GetPlayers().Count == 0); }