quakeball/Assets/Scripts/Networking/NetPlayer.cs

44 lines
1.1 KiB
C#

using UnityEngine;
using NeonTea.Quakeball.Game;
using NeonTea.Quakeball.Players;
namespace NeonTea.Quakeball.Networking {
public class NetPlayer {
private Player _Controlled;
private ulong _Id;
public ulong Id {
get { return _Id; }
set {
_Id = value;
if (_Controlled != null) {
_Controlled.NetId = _Id;
}
}
}
public Player Controlled {
get { return _Controlled; }
set {
_Controlled = value;
if (_Controlled != null) {
_Controlled.NetId = _Id;
}
}
}
public string Nick;
public Team Team = Team.FreeForAll;
public bool Ready;
public bool ReadyAndSpawned => Ready && _Controlled != null;
public bool Unsynced = false;
public float Ping = 0;
public NetPlayer(ulong id, bool ready, Player obj = null) {
Id = id;
Controlled = obj;
Ready = ready;
Nick = id.ToString();
}
}
}