quakeball/Assets/Scripts/Net/Packets/SpawnPckt.cs

39 lines
1003 B
C#

using UnityEngine;
using NeonTea.Quakeball.TeaNet.Packets;
namespace NeonTea.Quakeball.Net.Packets {
public class SpawnPckt : Packet {
public ulong PlayerId;
public Vector3 Location;
public override void Read(ByteBuffer buffer) {
float x = buffer.ReadFloat();
float y = buffer.ReadFloat();
float z = buffer.ReadFloat();
Location = new Vector3(x, y, z);
PlayerId = buffer.ReadULong();
}
public override void Write(ByteBuffer buffer) {
buffer.Write(Location.x);
buffer.Write(Location.y);
buffer.Write(Location.z);
buffer.Write(PlayerId);
}
}
public class SelfIdentPckt : Packet {
public ulong PlayerId;
public override void Read(ByteBuffer buffer) {
PlayerId = buffer.ReadULong();
}
public override void Write(ByteBuffer buffer) {
buffer.Write(PlayerId);
}
}
}