quakeball/Assets/Scripts/Networking/Packets/SpawnPckt.cs
2020-08-08 20:14:34 +03:00

53 lines
1.4 KiB
C#

using UnityEngine;
using NeonTea.Quakeball.TeaNet.Packets;
namespace NeonTea.Quakeball.Networking.Packets {
public class SpawnPckt : Packet {
public ulong PlayerId;
public Vector3 Location;
public bool IsInitial;
public SpawnPckt() { }
public SpawnPckt(Vector3 location, ulong id = 0, bool isinitial = true) {
PlayerId = id;
Location = location;
IsInitial = isinitial;
}
public override void Read(ByteBuffer buffer) {
Location = buffer.ReadVector3();
PlayerId = buffer.ReadULong();
IsInitial = buffer.ReadBool();
}
public override void Write(ByteBuffer buffer) {
buffer.Write(Location);
buffer.Write(PlayerId);
buffer.Write(IsInitial);
}
}
public class DeadPckt : Packet {
public ulong DeadPlayerId;
public ulong KillerPlayerId;
public DeadPckt() { }
public DeadPckt(ulong deadid, ulong killerid) {
DeadPlayerId = deadid;
KillerPlayerId = killerid;
}
public override void Read(ByteBuffer buffer) {
DeadPlayerId = buffer.ReadULong();
KillerPlayerId = buffer.ReadULong();
}
public override void Write(ByteBuffer buffer) {
buffer.Write(DeadPlayerId);
buffer.Write(KillerPlayerId);
}
}
}