Пример #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 Write(BodyChunk bodyChunk, ref BinaryWriter writer)
 {
     //IntVector2NHandler.Write(bodyChunk.ContactPoint, ref writer);
     //IntVector2NHandler.Write(bodyChunk.lastContactPoint, ref writer);
     //Vector2Handler.Write(bodyChunk.lastLastPos, ref writer);
     //Vector2Handler.Write(bodyChunk.lastPos, ref writer);
     Vector2Handler.Write(bodyChunk.pos, ref writer);
     Vector2Handler.Write(bodyChunk.vel, ref writer);
 }
Пример #3
0
        public static BodyChunk Read(BodyChunk bodyChunk, ref BinaryReader reader)
        {
            //(bodyChunk as Patches.patch_BodyChunk).Sync(IntVector2Handler.Read(ref reader));
            //bodyChunk.lastContactPoint = IntVector2Handler.Read(ref reader);

            //bodyChunk.lastLastPos = Vector2Handler.Read(ref reader);
            //bodyChunk.lastPos = Vector2Handler.Read(ref reader);
            bodyChunk.pos = Vector2Handler.Read(ref reader);
            bodyChunk.vel = Vector2Handler.Read(ref reader);
            return(bodyChunk);
        }
Пример #4
0
 public static void Write(PhysicalObject.Appendage appendage, ref BinaryWriter writer)
 {
     writer.Write(appendage.appIndex);
     writer.Write(appendage.canBeHit);
     writer.Write(appendage.segments.Length);
     for (int a = 0; a < appendage.segments.Length; a++)
     {
         Vector2Handler.Write(appendage.segments[a], ref writer);
     }
     writer.Write(appendage.totalLength);
 }
Пример #5
0
 public static void Write(Player player, ref BinaryWriter writer)
 {
     writer.Write(player.input[0].x);
     writer.Write(player.input[0].y);
     writer.Write(player.input[0].jmp);
     writer.Write(player.input[0].thrw);
     writer.Write(player.input[0].pckp);
     writer.Write(player.input[0].mp);
     writer.Write(player.input[0].gamePad);
     writer.Write(player.input[0].crouchToggle);
     Vector2Handler.Write(player.input[0].analogueDir, ref writer);
     writer.Write(player.input[0].downDiagonal);
 }
Пример #6
0
 public static void Write(Player.InputPackage input, ref BinaryWriter writer)
 {
     writer.Write(input.x);
     writer.Write(input.y);
     writer.Write(input.jmp);
     writer.Write(input.thrw);
     writer.Write(input.pckp);
     writer.Write(input.mp);
     writer.Write(input.gamePad);
     writer.Write(input.crouchToggle);
     Vector2Handler.Write(input.analogueDir, ref writer);
     writer.Write(input.downDiagonal);
 }
Пример #7
0
        public static BodyChunk Read(ref BinaryReader reader)
        {
            BodyChunk bodyChunk = new BodyChunk(null, 0, new Vector2(0f, 0f), 1f, 1f);

            //(bodyChunk as Patches.patch_BodyChunk).Sync(IntVector2Handler.Read(ref reader));
            //bodyChunk.lastContactPoint = IntVector2Handler.Read(ref reader);

            //bodyChunk.lastLastPos = Vector2Handler.Read(ref reader);
            //bodyChunk.lastPos = Vector2Handler.Read(ref reader);
            bodyChunk.pos = Vector2Handler.Read(ref reader);
            bodyChunk.vel = Vector2Handler.Read(ref reader);
            return(bodyChunk);
        }
Пример #8
0
 public static Player.InputPackage Read(Player.InputPackage input, ref BinaryReader reader)
 {
     input.x            = reader.ReadInt32();
     input.y            = reader.ReadInt32();
     input.jmp          = reader.ReadBoolean();
     input.thrw         = reader.ReadBoolean();
     input.pckp         = reader.ReadBoolean();
     input.mp           = reader.ReadBoolean();
     input.gamePad      = reader.ReadBoolean();
     input.crouchToggle = reader.ReadBoolean();
     input.analogueDir  = Vector2Handler.Read(ref reader);
     input.downDiagonal = reader.ReadInt32();
     return(input);
 }
Пример #9
0
            public static PhysicalObject.Appendage Read(PhysicalObject.Appendage appendage, ref BinaryReader reader)
            {
                appendage.appIndex = reader.ReadInt32();
                appendage.canBeHit = reader.ReadBoolean();
                int numberOfSegments = reader.ReadInt32();

                appendage.segments = new Vector2[numberOfSegments];
                for (int a = 0; a < numberOfSegments; a++)
                {
                    appendage.segments[a] = Vector2Handler.Read(ref reader);
                }
                appendage.totalLength = reader.ReadSingle();
                return(appendage);
            }
Пример #10
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);
        }
Пример #11
0
 public static void Read(Player player, ref BinaryReader reader)
 {
     for (int i = player.input.Length - 1; i > 0; i--)
     {
         player.input[i] = player.input[i - 1];
     }
     player.input[0].x            = reader.ReadInt32();
     player.input[0].y            = reader.ReadInt32();
     player.input[0].jmp          = reader.ReadBoolean();
     player.input[0].thrw         = reader.ReadBoolean();
     player.input[0].pckp         = reader.ReadBoolean();
     player.input[0].mp           = reader.ReadBoolean();
     player.input[0].gamePad      = reader.ReadBoolean();
     player.input[0].crouchToggle = reader.ReadBoolean();
     player.input[0].analogueDir  = Vector2Handler.Read(ref reader);
     player.input[0].downDiagonal = reader.ReadInt32();
 }