Пример #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;
        }
Пример #2
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;
 }
Пример #3
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);
 }
Пример #4
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);
        }