Example #1
0
 public virtual void Deserialize(NetworkBinaryReader reader, SerializationModeFlags mode, int framesAgo)
 {
     if (mode.HasFlag(SerializationModeFlags.ConstantDataFromServer) ||
         mode.HasFlag(SerializationModeFlags.ConstantDataFromClient))
     {
         Name = reader.ReadString();
     }
     if (mode.HasFlag(SerializationModeFlags.VaryingDataFromServer))
     {
         var isDisconnected = reader.ReadBoolean();
         if (IsRemote && isDisconnected) ConnectionStatus = ConnectionStatusType.Disconnected;
         if (IsDisconnected && !isDisconnected) ConnectionStatus = ConnectionStatusType.Remote;
         var oldTeam = Team;
         TeamProxy = reader.ReadTeamID(FindTeam);
         if (oldTeam != Team)
         {
             // Resign from old team now while we still have a direct reference to it.
             // The new team may not exist yet, so assign to it later in Update().
             if (oldTeam != null) oldTeam.UpdateAssignment(this);
             _teamAssignmentDeserialized = true;
         }
     }
     StatsData.Deserialize(reader, mode, framesAgo);
     ArenaStatistics.Deserialize(reader, mode, framesAgo);
 }