quakeball/Assets/Scripts/Networking/NetPlayer.cs

44 lines
1.1 KiB
C#
Raw Normal View History

using UnityEngine;
using NeonTea.Quakeball.Game;
2020-08-07 20:24:43 +02:00
using NeonTea.Quakeball.Players;
namespace NeonTea.Quakeball.Networking {
public class NetPlayer {
private Player _Controlled;
private ulong _Id;
2020-08-08 06:00:17 +02:00
public ulong Id {
get { return _Id; }
2020-08-08 06:00:17 +02:00
set {
_Id = value;
if (_Controlled != null) {
_Controlled.NetId = _Id;
2020-08-08 06:00:17 +02:00
}
}
}
public Player Controlled {
get { return _Controlled; }
2020-08-08 06:00:17 +02:00
set {
_Controlled = value;
if (_Controlled != null) {
_Controlled.NetId = _Id;
}
2020-08-08 06:00:17 +02:00
}
}
2020-08-08 19:14:34 +02:00
public string Nick;
public Team Team = Team.FreeForAll;
public bool Ready;
public bool ReadyAndSpawned => Ready && _Controlled != null;
2020-08-08 00:21:02 +02:00
public bool Unsynced = false;
2020-08-08 02:35:19 +02:00
public float Ping = 0;
public NetPlayer(ulong id, bool ready, Player obj = null) {
Id = id;
Controlled = obj;
Ready = ready;
2020-08-08 19:14:34 +02:00
Nick = id.ToString();
}
}
}