Exemple #1
0
        /* public static void Read(ref Weapon weapon, ref BinaryReader reader)
         * {
         *  PhysicalObjectHandler.Read(weapon, ref reader);
         *  weapon.changeDirCounter = reader.ReadInt32();
         *  weapon.closestCritDist = reader.ReadSingle();
         *  weapon.exitThrownModeSpeed = reader.ReadSingle();
         *  weapon.firstFrameTraceFromPos = Vector2NHandler.Read(ref reader);
         *  //Weapon.Mode lastMode = (Weapon.Mode)reader.ReadInt32();
         *  Weapon.Mode mode = (Weapon.Mode)reader.ReadInt32();
         *  if (mode != weapon.mode)
         *  {
         *      //weapon.ChangeOverlap(true);
         *      weapon.ChangeMode(mode);
         *  }
         *  if (mode == Weapon.Mode.Thrown && weapon.grabbedBy.Count > 0)
         *  {
         *      weapon.AllGraspsLetGoOfThisObject(false);
         *  }
         *  //weapon.lastMode = lastMode;
         *  weapon.mode = mode;
         *  weapon.rotation = Vector2Handler.Read(ref reader);
         *  weapon.rotationSpeed = reader.ReadSingle();
         *  weapon.throwModeFrames = reader.ReadInt32();
         *  weapon.thrownBy = DistHandler.ReadCreature(ref weapon.thrownBy, ref reader, weapon.room);
         *  weapon.thrownClosestToCreature = DistHandler.ReadCreature(ref weapon.thrownClosestToCreature, ref reader, weapon.room);
         *  weapon.thrownPos = Vector2Handler.Read(ref reader);
         * } */

        public static void Read(Weapon weapon, ref BinaryReader reader)
        {
            PhysicalObjectHandler.Read(weapon, ref reader);
            weapon.changeDirCounter       = reader.ReadInt32();
            weapon.closestCritDist        = reader.ReadSingle();
            weapon.exitThrownModeSpeed    = reader.ReadSingle();
            weapon.firstFrameTraceFromPos = Vector2NHandler.Read(ref reader);
            //Weapon.Mode lastMode = (Weapon.Mode)reader.ReadInt32();
            Weapon.Mode mode = (Weapon.Mode)reader.ReadInt32();
            if (mode != weapon.mode)
            {
                //weapon.ChangeOverlap(true);
                weapon.ChangeMode(mode);
            }
            if (mode == Weapon.Mode.Thrown && weapon.grabbedBy.Count > 0)
            {
                weapon.AllGraspsLetGoOfThisObject(false);
            }
            //weapon.lastMode = lastMode;
            weapon.mode                    = mode;
            weapon.rotation                = Vector2Handler.Read(ref reader);
            weapon.rotationSpeed           = reader.ReadSingle();
            weapon.throwModeFrames         = reader.ReadInt32();
            weapon.thrownBy                = DistHandler.ReadCreature(ref weapon.thrownBy, ref reader, weapon.room);
            weapon.thrownClosestToCreature = DistHandler.ReadCreature(ref weapon.thrownClosestToCreature, ref reader, weapon.room);
            weapon.thrownPos               = Vector2Handler.Read(ref reader);
            // return weapon;
        }
 public static void Write(Creature creature, ref BinaryWriter writer)
 {
     AbstractCreatureHandler.Write(creature.abstractCreature, ref writer);
     PhysicalObjectHandler.Write(creature, ref writer);
     //writer.Write(creature.blind);
     writer.Write(creature.dead);
     IntVector2NHandler.Write(creature.enteringShortCut, ref writer);
     WorldCoordinateHandler.Write(creature.lastCoord, ref writer);
     writer.Write(creature.leechedOut);
     writer.Write(creature.newToRoomInvinsibility);
     WorldCoordinateHandler.Write(creature.NPCTransportationDestination, ref writer);
     writer.Write(creature.shortcutDelay);
 }
Exemple #3
0
 public static void Read(Creature creature, ref BinaryReader reader)
 {
     AbstractCreatureHandler.Read(creature, ref reader);
     PhysicalObjectHandler.Read(creature, ref reader);
     //creature.blind = reader.ReadInt32();
     CreatureHK.Sync(creature, reader.ReadBoolean());
     creature.enteringShortCut             = IntVector2NHandler.Read(ref reader);
     creature.lastCoord                    = WorldCoordinateHandler.Read(ref reader);
     creature.leechedOut                   = reader.ReadBoolean();
     creature.newToRoomInvinsibility       = reader.ReadInt32();
     creature.NPCTransportationDestination = WorldCoordinateHandler.Read(ref reader);
     creature.shortcutDelay                = reader.ReadInt32();
     // return creature;
 }
Exemple #4
0
 public static Creature Read(Creature creature, ref BinaryReader reader)
 {
     creature.abstractPhysicalObject = AbstractCreatureHandler.Read(creature.abstractCreature, ref reader);
     creature = PhysicalObjectHandler.Read(creature, ref reader);
     //creature.blind = reader.ReadInt32();
     (creature as Patches.patch_Player).Sync(reader.ReadBoolean());
     creature.enteringShortCut             = IntVector2NHandler.Read(ref reader);
     creature.lastCoord                    = WorldCoordinateHandler.Read(ref reader);
     creature.leechedOut                   = reader.ReadBoolean();
     creature.newToRoomInvinsibility       = reader.ReadInt32();
     creature.NPCTransportationDestination = WorldCoordinateHandler.Read(ref reader);
     creature.shortcutDelay                = reader.ReadInt32();
     return(creature);
 }
Exemple #5
0
        /* public static Spear Read(Spear weapon, ref BinaryReader reader)
         * {
         *  weapon = PhysicalObjectHandler.Read(weapon, ref reader);
         *  weapon.changeDirCounter = reader.ReadInt32();
         *  weapon.closestCritDist = reader.ReadSingle();
         *  weapon.exitThrownModeSpeed = reader.ReadSingle();
         *  weapon.firstFrameTraceFromPos = Vector2NHandler.Read(ref reader);
         *  //Weapon.Mode lastMode = (Weapon.Mode)reader.ReadInt32();
         *  Weapon.Mode mode = (Weapon.Mode)reader.ReadInt32();
         *  if (mode != weapon.mode)
         *  {
         *      //weapon.ChangeOverlap(true);
         *      weapon.ChangeMode(mode);
         *  }
         *  if (mode == Weapon.Mode.Thrown && weapon.grabbedBy.Count > 0)
         *  {
         *      weapon.AllGraspsLetGoOfThisObject(false);
         *  }
         *  //weapon.lastMode = lastMode;
         *  weapon.mode = mode;
         *  weapon.rotation = Vector2Handler.Read(ref reader);
         *  weapon.rotationSpeed = reader.ReadSingle();
         *  weapon.throwModeFrames = reader.ReadInt32();
         *  weapon.thrownBy = DistHandler.ReadCreature(ref weapon.thrownBy, ref reader, weapon.room);
         *  weapon.thrownClosestToCreature = DistHandler.ReadCreature(ref weapon.thrownClosestToCreature, ref reader, weapon.room);
         *  weapon.thrownPos = Vector2Handler.Read(ref reader);
         *  return weapon;
         * } */

        public static void Write(Weapon weapon, ref BinaryWriter writer)
        {
            PhysicalObjectHandler.Write(weapon, ref writer);
            writer.Write(weapon.changeDirCounter);
            writer.Write(weapon.closestCritDist);
            writer.Write(weapon.exitThrownModeSpeed);
            Vector2NHandler.Write(weapon.firstFrameTraceFromPos, ref writer);
            //writer.Write((int)weapon.lastMode);
            writer.Write((int)weapon.mode);
            Vector2Handler.Write(weapon.rotation, ref writer);
            writer.Write(weapon.rotationSpeed);
            writer.Write(weapon.throwModeFrames);
            DistHandler.Write(weapon.thrownBy, ref writer);
            DistHandler.Write(weapon.thrownClosestToCreature, ref writer);
            Vector2Handler.Write(weapon.thrownPos, ref writer);
        }
Exemple #6
0
        public static Player Read(Player creature, ref BinaryReader reader)
        {
            creature.abstractPhysicalObject = AbstractCreatureHandler.Read(creature.abstractCreature, ref reader);
            creature = PhysicalObjectHandler.Read(creature, ref reader);
            //creature.blind = reader.ReadInt32();
            (creature as Patches.patch_Player).Sync(reader.ReadBoolean());
            creature.enteringShortCut             = IntVector2NHandler.Read(ref reader);
            creature.lastCoord                    = WorldCoordinateHandler.Read(ref reader);
            creature.leechedOut                   = reader.ReadBoolean();
            creature.newToRoomInvinsibility       = reader.ReadInt32();
            creature.NPCTransportationDestination = WorldCoordinateHandler.Read(ref reader);
            creature.shortcutDelay                = reader.ReadInt32();

            /*int len = reader.ReadInt32();
             * for (int i = 0; i < len; i++)
             * {
             *  if (i < creature.grasps.Length && creature.grasps[i] != null)
             *  {
             *      creature.grasps[i] = GraspHandler.Read(ref creature.grasps[i], creature, ref reader, creature.room);
             *  }
             *  else
             *  {
             *      Creature.Grasp grasp = GraspHandler.Read(creature, ref reader, creature.room);
             *      if (i < creature.grasps.Length && grasp != null && grasp.grabbed != null && grasp.grabber != null)
             *      {
             *          MonklandSteamManager.Log("Grabbed Rock!");
             *          (creature as Player).switchHandsCounter = 0;
             *          ((creature as Player) as patch_Player).setWantToPickUp(0);
             *          (creature as Player).noPickUpOnRelease = 20;
             *          if (creature.grasps[i] != null)
             *          {
             *              creature.ReleaseGrasp(i);
             *          }
             *          creature.grasps[i] = new Creature.Grasp(creature, grasp.grabbed, i, grasp.chunkGrabbed, grasp.shareability, grasp.dominance, grasp.pacifying);
             *          grasp.grabbed.Grabbed(creature.grasps[i]);
             *          new AbstractPhysicalObject.CreatureGripStick(creature.abstractCreature, grasp.grabbed.abstractPhysicalObject, i, grasp.pacifying);
             *      }
             *  }
             * }*/
            return(creature);
        }