예제 #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(Spear spear, ref BinaryWriter writer)
 {
     Vector2NHandler.Write(spear.stuckInWall, ref writer);
     WeaponHandler.Write(spear, ref writer);
     writer.Write(spear.alwaysStickInWalls);
     writer.Write(spear.pinToWallCounter);
     writer.Write(spear.spearDamageBonus);
     DistHandler.Write(spear.stuckInObject, ref writer);
     Vector2NHandler.Write(spear.stuckInWall, ref writer);
     writer.Write(spear.stuckRotation);
 }
예제 #3
0
 public static Spear Read(Spear spear, ref BinaryReader reader)
 {
     spear.stuckInWall = Vector2NHandler.Read(ref reader);
     WeaponHandler.Read(spear, ref reader);
     spear.alwaysStickInWalls = reader.ReadBoolean();
     spear.pinToWallCounter   = reader.ReadInt32();
     spear.spearDamageBonus   = reader.ReadSingle();
     spear.stuckInObject      = DistHandler.ReadPhysicalObject(ref spear.stuckInObject, ref reader, spear.room);
     spear.stuckInWall        = Vector2NHandler.Read(ref reader);
     spear.stuckRotation      = reader.ReadSingle();
     return(spear);
 }
예제 #4
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);
        }