Exemplo n.º 1
0
        public InterpretedMotionState(MovementData data)
        {
            MovementData = data;
            CurrentStyle = data.CurrentStyle;

            Flags = BuildMovementFlags();
        }
Exemplo n.º 2
0
        public MovementInvalid(MovementData movementData, Motion motion)
        {
            MovementData = movementData;

            State = new InterpretedMotionState(movementData, motion);

            if ((motion.MotionFlags & MotionFlags.StickToObject) != 0)
            {
                StickyObject = motion.TargetGuid;
            }
        }
Exemplo n.º 3
0
        public static void Write(this BinaryWriter writer, MovementData motion, bool header = true)
        {
            var wo       = motion.WorldObject;
            var sequence = wo.Sequences;

            if (header)
            {
                writer.Write(sequence.GetNextSequence(SequenceType.ObjectMovement));

                if (motion.IsAutonomous)
                {
                    writer.Write(sequence.GetCurrentSequence(SequenceType.ObjectServerControl));
                }
                else
                {
                    writer.Write(sequence.GetNextSequence(SequenceType.ObjectServerControl));
                }

                writer.Write(Convert.ToByte(motion.IsAutonomous));
                writer.Align();
            }

            writer.Write((byte)motion.MovementType);
            writer.Write((byte)motion.MotionFlags);

            writer.Write((ushort)motion.CurrentStyle);    // send MotionStance as ushort

            switch (motion.MovementType)
            {
            case MovementType.Invalid:
                writer.Write(motion.Invalid);
                break;

            case MovementType.MoveToObject:
                writer.Write(motion.MoveToObject);
                break;

            case MovementType.MoveToPosition:
                writer.Write(motion.MoveToPosition);
                break;

            case MovementType.TurnToObject:
                writer.Write(motion.TurnToObject);
                break;

            case MovementType.TurnToHeading:
                writer.Write(motion.TurnToHeading);
                break;
            }
        }
Exemplo n.º 4
0
        public InterpretedMotionState(MovementData data, Motion motion)
        {
            MovementData = data;
            CurrentStyle = data.CurrentStyle;

            var state = motion.MotionState;

            ForwardCommand  = state.ForwardCommand;
            SidestepCommand = state.SidestepCommand;
            TurnCommand     = state.TurnCommand;

            ForwardSpeed  = state.ForwardSpeed;
            SidestepSpeed = state.SidestepSpeed;
            TurnSpeed     = state.TurnSpeed;

            Commands = state.Commands;

            Flags = BuildMovementFlags();
        }
Exemplo n.º 5
0
        public InterpretedMotionState(InterpretedMotionState state)
        {
            // copy constructor
            Flags           = state.Flags;
            MovementData    = state.MovementData;
            CurrentStyle    = state.CurrentStyle;
            ForwardCommand  = state.ForwardCommand;
            SidestepCommand = state.SidestepCommand;
            TurnCommand     = state.TurnCommand;
            ForwardSpeed    = state.ForwardSpeed;
            SidestepSpeed   = state.SidestepSpeed;
            TurnSpeed       = state.TurnSpeed;

            if (state.Commands != null)
            {
                Commands = new List <MotionItem>();
                foreach (var command in state.Commands)
                {
                    Commands.Add(new MotionItem(command));
                }
            }
        }
Exemplo n.º 6
0
 public MovementInvalid(MovementData movementData, InterpretedMotionState state)
 {
     MovementData = movementData;
     State        = state;
     state.BuildMovementFlags();
 }
Exemplo n.º 7
0
        public ObjectGuid StickyObject;         // choose valid sections by masking against MotionFlags: 0x1 - object to stick to

        public MovementInvalid(MovementData movementData)
        {
            MovementData = movementData;
            State        = new InterpretedMotionState(movementData);
        }