49 lines
1.4 KiB
C#
49 lines
1.4 KiB
C#
using UnityEngine;
|
|
using NeonTea.Quakeball.TeaNet.Packets;
|
|
|
|
namespace NeonTea.Quakeball.Net.Packets {
|
|
public class PlayerUpdatePckt : Packet {
|
|
|
|
public ulong PlayerId;
|
|
|
|
public Vector3 MoveDirection;
|
|
public byte MoveStyle;
|
|
public bool Jumping;
|
|
public float Pitch;
|
|
public float Yaw;
|
|
|
|
public PlayerUpdatePckt() { }
|
|
|
|
public PlayerUpdatePckt(Vector3 moveDirection, byte moveStyle, bool jumping, float pitch, float yaw) {
|
|
MoveDirection = moveDirection;
|
|
MoveStyle = moveStyle;
|
|
Jumping = jumping;
|
|
Pitch = pitch;
|
|
Yaw = yaw;
|
|
}
|
|
|
|
public override void Read(ByteBuffer buffer) {
|
|
PlayerId = buffer.ReadULong();
|
|
float x = buffer.ReadFloat();
|
|
float y = buffer.ReadFloat();
|
|
float z = buffer.ReadFloat();
|
|
MoveDirection = new Vector3(x, y, z);
|
|
MoveStyle = buffer.Read();
|
|
Jumping = buffer.ReadBool();
|
|
Pitch = buffer.ReadFloat();
|
|
Yaw = buffer.ReadFloat();
|
|
}
|
|
|
|
public override void Write(ByteBuffer buffer) {
|
|
buffer.Write(PlayerId);
|
|
buffer.Write(MoveDirection.x);
|
|
buffer.Write(MoveDirection.y);
|
|
buffer.Write(MoveDirection.z);
|
|
buffer.Write(MoveStyle);
|
|
buffer.Write(Jumping);
|
|
buffer.Write(Pitch);
|
|
buffer.Write(Yaw);
|
|
}
|
|
}
|
|
}
|