public static void Write(AbstractWorldEntity entity, ref BinaryWriter writer)
 {
     EntityIDHandler.Write(entity.ID, ref writer);
     WorldCoordinateHandler.Write(entity.pos, ref writer);
     writer.Write(entity.InDen);
     writer.Write(entity.timeSpentHere);
 }
 public static AbstractWorldEntity Read(AbstractWorldEntity entity, ref BinaryReader reader)
 {
     entity.ID            = EntityIDHandler.Read(ref reader);
     entity.pos           = WorldCoordinateHandler.Read(ref reader);
     entity.InDen         = reader.ReadBoolean();
     entity.timeSpentHere = reader.ReadInt32();
     return(entity);
 }
Beispiel #3
0
 public static void Write(AbstractPhysicalObject physicalObject, ref BinaryWriter writer)
 {
     EntityIDHandler.Write(physicalObject.ID, ref writer);
     WorldCoordinateHandler.Write(physicalObject.pos, ref writer);
     writer.Write(physicalObject.InDen);
     writer.Write(physicalObject.timeSpentHere);
     writer.Write((byte)physicalObject.type);
     writer.Write((physicalObject as Patches.patch_AbstractPhysicalObject).dist);
 }
        /* public static AbstractPhysicalObject Read(AbstractPhysicalObject physicalObject, ref BinaryReader reader)
         * {
         *  physicalObject.ID = EntityIDHandler.Read(ref reader);
         *  physicalObject.pos = WorldCoordinateHandler.Read(ref reader);
         *  physicalObject.InDen = reader.ReadBoolean();
         *  physicalObject.timeSpentHere = reader.ReadInt32();
         *  physicalObject.type = (AbstractPhysicalObject.AbstractObjectType)reader.ReadByte();
         *  physicalObject.ID.number = reader.ReadInt32();
         *  physicalObject.destroyOnAbstraction = true;
         *  return physicalObject;
         * } */

        public static void Read(AbstractPhysicalObject physicalObject, ref BinaryReader reader)
        {
            physicalObject.ID                   = EntityIDHandler.Read(ref reader);
            physicalObject.pos                  = WorldCoordinateHandler.Read(ref reader);
            physicalObject.InDen                = reader.ReadBoolean();
            physicalObject.timeSpentHere        = reader.ReadInt32();
            physicalObject.type                 = (AbstractPhysicalObject.AbstractObjectType)reader.ReadByte();
            physicalObject.ID.number            = reader.ReadInt32();
            physicalObject.destroyOnAbstraction = true;
        }
Beispiel #5
0
 public static AbstractPhysicalObject Read(AbstractPhysicalObject physicalObject, ref BinaryReader reader)
 {
     physicalObject.ID            = EntityIDHandler.Read(ref reader);
     physicalObject.pos           = WorldCoordinateHandler.Read(ref reader);
     physicalObject.InDen         = reader.ReadBoolean();
     physicalObject.timeSpentHere = reader.ReadInt32();
     physicalObject.type          = (AbstractPhysicalObject.AbstractObjectType)reader.ReadByte();
     (physicalObject as Patches.patch_AbstractPhysicalObject).dist = reader.ReadInt32();
     physicalObject.destroyOnAbstraction = true;
     return(physicalObject);
 }
Beispiel #6
0
 public static void Write(AbstractCreature creature, ref BinaryWriter writer)
 {
     EntityIDHandler.Write(creature.ID, ref writer);
     WorldCoordinateHandler.Write(creature.pos, ref writer);
     writer.Write(creature.InDen);
     writer.Write(creature.timeSpentHere);
     //writer.Write((byte)creature.type);
     writer.Write(AbstractPhysicalObjectHK.GetField(creature).dist);
     //AbstractCreatureAIHandler.Write(creature.abstractAI, ref writer);
     //Additional personality and relationship traits should be synced here!
     writer.Write(creature.remainInDenCounter);
     WorldCoordinateHandler.Write(creature.spawnDen, ref writer);
     //creature state should also be synced here!!
 }
Beispiel #7
0
 public static void Read(AbstractCreature creature, ref BinaryReader reader)
 {
     creature.ID            = EntityIDHandler.Read(ref reader);
     creature.pos           = WorldCoordinateHandler.Read(ref reader);
     creature.InDen         = reader.ReadBoolean();
     creature.timeSpentHere = reader.ReadInt32();
     //creature.type = (AbstractPhysicalObject.AbstractObjectType)reader.ReadByte();
     creature.ID.number            = reader.ReadInt32();
     creature.destroyOnAbstraction = true;
     //creature.abstractAI = AbstractCreatureAIHandler.Read(creature.abstractAI, ref reader);
     //Additional personality and relationship traits should be synced here!
     creature.remainInDenCounter = reader.ReadInt32();
     creature.spawnDen           = WorldCoordinateHandler.Read(ref reader);
     //creature state should also be synced here!!
     //return creature;
 }