コード例 #1
0
 private void OnPlayerPosition(PlayerPositionPacket p)
 {
     if (PlayerPosition != null) PlayerPosition.Invoke(this, new PacketEventArgs<PlayerPositionPacket>(p));
 }
コード例 #2
0
ファイル: PacketHandlers.cs プロジェクト: IdentErr/c-raft
        public static void ReadPlayerPosition(Client client, PacketReader reader)
        {
            PlayerPositionPacket pp = new PlayerPositionPacket();
            pp.Read(reader);

            if (!reader.Failed)
                Client.HandlePacketPlayerPosition(client, pp);
        }
コード例 #3
0
ファイル: Client.Recv.cs プロジェクト: AVATAR-Phoenix/c-raft
        public static void HandlePacketPlayerPosition(Client client, PlayerPositionPacket packet)
        {
            //client.Logger.Log(Chraft.Logger.LogLevel.Info, "Player position: {0} {1} {2}", packet.X, packet.Y, packet.Z);
            client.Owner.Ready = true;
            client.Owner.MoveTo(packet.X, packet.Y, packet.Z);
            client.OnGround = packet.OnGround;
            client.Stance = packet.Stance;

            client.CheckAndUpdateChunks(packet.X, packet.Z);
        }
コード例 #4
0
ファイル: Client.Recv.cs プロジェクト: dekema2/c-raft
        public static void HandlePacketPlayerPosition(Client client, PlayerPositionPacket packet)
        {
            if(client.WaitForInitialPosAck)
                return;

            //client.Logger.Log(Chraft.Logger.LogLevel.Info, "Player position: {0} {1} {2}", packet.X, packet.Y, packet.Z);
            client.Owner.Ready = true;
            double threshold = 0.001;
            double diffX = Math.Abs(client.Owner.Position.X - packet.X);
            double diffY = Math.Abs(client.Owner.Position.Y - packet.Y);
            double diffZ = Math.Abs(client.Owner.Position.Z - packet.Z);
            if (diffX < threshold && diffY < threshold && diffZ < threshold)
                return;

            client.Owner.MoveTo(new AbsWorldCoords(packet.X, packet.Y, packet.Z));
            client.OnGround = packet.OnGround;
            client.Stance = packet.Stance;

            client.CheckAndUpdateChunks(packet.X, packet.Z);
        }