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

67 lines
1.7 KiB
C#
Raw Normal View History

using UnityEngine;
using NeonTea.Quakeball.TeaNet.Packets;
namespace NeonTea.Quakeball.Networking.Packets {
public class SpawnPckt : Packet {
public ulong PlayerId;
public Vector3 Location;
2020-08-08 08:50:37 +02:00
public bool IsInitial;
2020-08-08 08:57:59 +02:00
public SpawnPckt() { }
2020-08-08 08:50:37 +02:00
public SpawnPckt(Vector3 location, ulong id = 0, bool isinitial = true) {
PlayerId = id;
Location = location;
IsInitial = isinitial;
}
public override void Read(ByteBuffer buffer) {
2020-08-08 08:57:59 +02:00
Location = buffer.ReadVector3();
PlayerId = buffer.ReadULong();
2020-08-08 08:50:37 +02:00
IsInitial = buffer.ReadBool();
}
public override void Write(ByteBuffer buffer) {
2020-08-08 08:57:59 +02:00
buffer.Write(Location);
buffer.Write(PlayerId);
2020-08-08 08:50:37 +02:00
buffer.Write(IsInitial);
}
}
2020-08-08 14:37:55 +02:00
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);
}
}
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);
}
}
}