コード例 #1
0
 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);
 }
コード例 #2
0
 void Awake()
 {
     NetPlayer = new C4NO.NetworkPlayer();
 }