2020-08-07 03:46:09 +02:00
|
|
|
|
using UnityEngine;
|
2020-08-10 01:57:33 +02:00
|
|
|
|
using NeonTea.Quakeball.Game;
|
2020-08-07 20:24:43 +02:00
|
|
|
|
using NeonTea.Quakeball.Players;
|
2020-08-07 03:46:09 +02:00
|
|
|
|
|
2020-08-07 20:20:13 +02:00
|
|
|
|
namespace NeonTea.Quakeball.Networking {
|
2020-08-07 03:46:09 +02:00
|
|
|
|
public class NetPlayer {
|
2020-08-08 07:19:46 +02:00
|
|
|
|
private Player _Controlled;
|
|
|
|
|
private ulong _Id;
|
|
|
|
|
|
2020-08-08 06:00:17 +02:00
|
|
|
|
public ulong Id {
|
2020-08-08 07:19:46 +02:00
|
|
|
|
get { return _Id; }
|
2020-08-08 06:00:17 +02:00
|
|
|
|
set {
|
2020-08-08 07:19:46 +02:00
|
|
|
|
_Id = value;
|
|
|
|
|
if (_Controlled != null) {
|
|
|
|
|
_Controlled.NetId = _Id;
|
2020-08-08 06:00:17 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public Player Controlled {
|
2020-08-08 07:19:46 +02:00
|
|
|
|
get { return _Controlled; }
|
2020-08-08 06:00:17 +02:00
|
|
|
|
set {
|
2020-08-08 07:19:46 +02:00
|
|
|
|
_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;
|
2020-08-10 01:57:33 +02:00
|
|
|
|
public Team Team = Team.FreeForAll;
|
2020-08-14 15:21:37 +02:00
|
|
|
|
|
|
|
|
|
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;
|
2020-08-07 03:46:09 +02:00
|
|
|
|
|
2020-08-14 15:21:37 +02:00
|
|
|
|
public NetPlayer(ulong id, bool ready, Player obj = null) {
|
2020-08-07 03:46:09 +02:00
|
|
|
|
Id = id;
|
|
|
|
|
Controlled = obj;
|
2020-08-14 15:21:37 +02:00
|
|
|
|
Ready = ready;
|
2020-08-08 19:14:34 +02:00
|
|
|
|
Nick = id.ToString();
|
2020-08-07 03:46:09 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|