bool AddPlayerToRoom(C4NO.NetworkPlayer player, RoomManager room) { if (room.IsEmpty) { //Shorthand: adding a player to a room returns an int, //which can be assigned back to the playerRoom attribute return((player.playerRoom = room.AddPlayer(player.id)) != -1); } else if (room.HasRoom) { foreach (C4NO.NetworkPlayer netPlayer in m_NetworkPlayers) { if (netPlayer.playerRoom == room.roomID) { if (Mathf.Abs(player.SkillLv - netPlayer.SkillLv) < m_tolerance) { return((player.playerRoom = room.AddPlayer(player.id)) != -1); } } } } return(false); }
void Awake() { NetPlayer = new C4NO.NetworkPlayer(); }