Example #1
0
 public static void Write(this BinaryWriter writer, MoveToObject moveTo)
 {
     writer.WriteGuid(moveTo.Target);
     writer.Write(moveTo.Origin);
     writer.Write(moveTo.MoveToParams);
     writer.Write(moveTo.RunRate);
 }
Example #2
0
        public MovementData(WorldObject wo, Motion motion)
        {
            WorldObject = wo;
            //var sequence = wo.Sequences;

            // do this here, or in network writer?
            IsAutonomous = motion.IsAutonomous;
            //MovementSequence = BitConverter.ToUInt16(sequence.GetNextSequence(SequenceType.ObjectMovement));

            //if (IsAutonomous)
            //ServerControlSequence = BitConverter.ToUInt16(sequence.GetCurrentSequence(SequenceType.ObjectServerControl));
            //else
            //ServerControlSequence = BitConverter.ToUInt16(sequence.GetNextSequence(SequenceType.ObjectServerControl));

            MovementType = motion.MovementType;
            MotionFlags  = motion.MotionFlags;

            //if (motion.HasTarget)
            //MotionFlags |= MotionFlags.StickToObject;
            //if (motion.StandingLongJump)
            //MotionFlags |= MotionFlags.StandingLongJump;    // indicates if player started charging jump bar while standing still

            CurrentStyle = motion.Stance;

            switch (MovementType)
            {
            case MovementType.Invalid:
                Invalid = new MovementInvalid(this, motion);
                break;

            case MovementType.MoveToObject:
                MoveToObject = new MoveToObject(motion);
                break;

            case MovementType.MoveToPosition:
                MoveToPosition = new MoveToPosition(motion);
                break;

            case MovementType.TurnToObject:
                TurnToObject = new TurnToObject(motion);
                break;

            case MovementType.TurnToHeading:
                TurnToHeading = new TurnToHeading(motion);
                break;
            }
        }