2020-08-07 02:45:29 +02:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
using NeonTea.Quakeball.TeaNet.Packets;
|
|
|
|
|
|
2020-08-07 20:20:13 +02:00
|
|
|
|
namespace NeonTea.Quakeball.Networking.Packets {
|
2020-08-07 02:45:29 +02:00
|
|
|
|
public class PlayerUpdatePckt : Packet {
|
|
|
|
|
|
2020-08-07 05:24:46 +02:00
|
|
|
|
public ulong PlayerId;
|
|
|
|
|
|
2020-08-07 02:45:29 +02:00
|
|
|
|
public Vector3 MoveDirection;
|
|
|
|
|
public byte MoveStyle;
|
|
|
|
|
public float Pitch;
|
|
|
|
|
public float Yaw;
|
|
|
|
|
|
|
|
|
|
public PlayerUpdatePckt() { }
|
|
|
|
|
|
2020-08-07 22:09:31 +02:00
|
|
|
|
public PlayerUpdatePckt(Vector3 moveDirection, byte moveStyle, float pitch, float yaw, ulong id = 0) {
|
2020-08-07 02:45:29 +02:00
|
|
|
|
MoveDirection = moveDirection;
|
|
|
|
|
MoveStyle = moveStyle;
|
|
|
|
|
Pitch = pitch;
|
|
|
|
|
Yaw = yaw;
|
2020-08-07 21:07:58 +02:00
|
|
|
|
PlayerId = id;
|
2020-08-07 02:45:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Read(ByteBuffer buffer) {
|
2020-08-07 05:24:46 +02:00
|
|
|
|
PlayerId = buffer.ReadULong();
|
2020-08-07 23:47:03 +02:00
|
|
|
|
MoveDirection = buffer.ReadVector3();
|
2020-08-07 05:24:46 +02:00
|
|
|
|
MoveStyle = buffer.Read();
|
|
|
|
|
Pitch = buffer.ReadFloat();
|
|
|
|
|
Yaw = buffer.ReadFloat();
|
2020-08-07 02:45:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Write(ByteBuffer buffer) {
|
2020-08-07 05:24:46 +02:00
|
|
|
|
buffer.Write(PlayerId);
|
2020-08-07 23:47:03 +02:00
|
|
|
|
buffer.Write(MoveDirection);
|
2020-08-07 05:24:46 +02:00
|
|
|
|
buffer.Write(MoveStyle);
|
|
|
|
|
buffer.Write(Pitch);
|
|
|
|
|
buffer.Write(Yaw);
|
2020-08-07 02:45:29 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|