quakeball/Assets/Scripts/Networking/Packets/PlayerSyncPacket.cs

35 lines
1.0 KiB
C#
Raw Permalink Normal View History

using UnityEngine;
using NeonTea.Quakeball.TeaNet.Packets;
namespace NeonTea.Quakeball.Networking.Packets {
public class PlayerSyncPacket : Packet {
public ulong PlayerId;
public bool Unsynced;
public Vector3 Location;
public Vector3 GroundVelocity;
public PlayerSyncPacket() { }
public PlayerSyncPacket(ulong id, bool unsynced, Vector3 location, Vector3 groundVelocity) {
PlayerId = id;
Unsynced = unsynced;
Location = location;
GroundVelocity = groundVelocity;
}
public override void Read(ByteBuffer buffer) {
PlayerId = buffer.ReadULong();
Unsynced = buffer.ReadBool();
Location = buffer.ReadVector3();
GroundVelocity = buffer.ReadVector3();
}
public override void Write(ByteBuffer buffer) {
buffer.Write(PlayerId);
buffer.Write(Unsynced);
buffer.Write(Location);
buffer.Write(GroundVelocity);
}
}
}