Ejemplo n.º 1
0
        public Bullet(PacketReader reader)
        {
            this.Location =
                new Vector2(
                    NetPacker.ShortToBigFloat(reader.ReadInt16()),
                    NetPacker.ShortToBigFloat(reader.ReadInt16()));

            this.Trajectory =
                new Vector2(
                    NetPacker.ShortToBigFloat(reader.ReadInt16()),
                    NetPacker.ShortToBigFloat(reader.ReadInt16()));

            this.owner = NetPacker.ShortToInt(reader.ReadInt16());

            this.rotation = GlobalFunctions.GetAngle(new Vector2(),
                                                     Trajectory);
            this.Exists = true;
            this.frame  = 0.5f;

            this.additive = true;
        }
Ejemplo n.º 2
0
        public void ReadFromNet(PacketReader reader)
        {
            Loc.X = NetPacker.ShortToBigFloat(reader.ReadInt16());
            Loc.Y = NetPacker.ShortToBigFloat(reader.ReadInt16());

            Anim      = NetPacker.ShortToInt(reader.ReadInt16());
            AnimFrame = NetPacker.ShortToInt(reader.ReadInt16());
            AnimName  = charDef.GetAnimation(Anim).name;
            frame     = NetPacker.ShortToMidFloat(reader.ReadInt16());

            if (reader.ReadBoolean())
            {
                State = CharState.Air;
            }
            else
            {
                State = CharState.Grounded;
            }

            if (reader.ReadBoolean())
            {
                Face = CharDir.Right;
            }
            else
            {
                Face = CharDir.Left;
            }

            Trajectory.X = NetPacker.ShortToBigFloat(reader.ReadInt16());
            Trajectory.Y = NetPacker.ShortToBigFloat(reader.ReadInt16());

            KeyRight = reader.ReadBoolean();
            KeyLeft  = reader.ReadBoolean();

            HP = NetPacker.ShortToInt(reader.ReadInt16());

            ReceivedNetUpdate = true;
        }