KitchenChaos/Assets/Scripts/PlayerData.cs

23 lines
700 B
C#

using System;
using Unity.Collections;
using Unity.Netcode;
public struct PlayerData : IEquatable<PlayerData>, INetworkSerializable {
public ulong ClientId;
public int ColorId;
public FixedString64Bytes PlayerName;
public FixedString64Bytes PlayerId;
public bool Equals(PlayerData other)
=> ClientId == other.ClientId &&
ColorId == other.ColorId &&
PlayerName == other.PlayerName &&
PlayerId == other.PlayerId;
public void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter {
serializer.SerializeValue(ref ClientId);
serializer.SerializeValue(ref ColorId);
serializer.SerializeValue(ref PlayerName);
serializer.SerializeValue(ref PlayerId);
}
}