//Agrega a un jugador a la sala. Retorna true si lo consigue, false si está llena. public bool AddPlayer(int connectionId, string address) { if (IsFull()) { return(false); } NetworkPlayer newPlayer = new NetworkPlayer(connectionId, GetCharId(numJugadores), this, address); players.Add(newPlayer); numJugadores++; SetControlEnemies(newPlayer); if (IsFull()) { Debug.Log("Full room"); sender.SendChangeScene(sceneToLoad, this); started = true; SendMessageToAllPlayers("Mago: Conectado", false); SendMessageToAllPlayers("Guerrero: Conectado", false); SendMessageToAllPlayers("Ingeniero: Conectado", false); } return(true); }
public bool AddPlayer(int connectionId, string address) { if (IsFull()) { return(false); } NetworkPlayer newPlayer = new NetworkPlayer(connectionId, GetPlayerId(), this, address); players.Add(newPlayer); SetControlEnemies(newPlayer); if (IsFull()) { Debug.Log("Full room"); sender.SendChangeScene(sceneToLoad, this); started = true; SendMessageToAllPlayers("Verde: Conectado", false); SendMessageToAllPlayers("Rojo: Conectado", false); SendMessageToAllPlayers("Amarillo: Conectado", false); } return(true); }