Ejemplo n.º 1
0
        private static void ReadMovement(Client client, PacketReader reader)
        {
            MovePacket mp = new MovePacket();
            mp.Read(reader);

            if (!reader.Failed)
            {
                Client.HandleMovePacket(client, mp);
            }
        }
Ejemplo n.º 2
0
        public MovePacket CreatePreperedMovePacket(TimeSpan totalTime)
        {
            if (this.ExecutePreparedMove(totalTime))
            {
                MovePacket mp = new MovePacket
                {
                    EntityId = Id,
                    Direction = Direction,
                    Position = Position,
                    Speed = IsMoving ? Speed : 0.0f,
                };

                return mp;
            }
            return null;
        }
Ejemplo n.º 3
0
 public static void HandleMovePacket(Client client, MovePacket mp)
 {
     client.Player.PrepareToMove(mp.Direction, mp.Speed);
 }
Ejemplo n.º 4
0
        public static void ReadMovement(Client client, PacketReader reader)
        {
            MovePacket mp = new MovePacket();
            mp.Read(reader);

            if (!reader.Failed)
            {
                Console.WriteLine("Received Move Packet");
                client.Move(
                    mp.EntityId,
                    mp.Position,
                    mp.Direction,
                    mp.Speed);
            }
        }
Ejemplo n.º 5
0
 private void SendStopMoving()
 {
     if (_lastMovementDirection == null)
     {
         return;
     }
     _lastMovementDirection = null;
     MovePacket movePacket = new MovePacket
     {
         EntityId = Id,
         Direction = 0,
         Speed = 0
     };
     _client.SendPacket(movePacket);
 }
Ejemplo n.º 6
0
 private void SendMove(float direction)
 {
     if (_lastMovementDirection != null && _lastMovementDirection == direction)
     {
         return;
     }
     _lastMovementDirection = direction;
     MovePacket movePacket = new MovePacket
     {
         EntityId = Id,
         Direction = direction,
         Speed = Speed
     };
     _client.SendPacket(movePacket);
 }