2020-12-07 21:19:16 +00:00
|
|
|
|
using QuantumUNET.Components;
|
|
|
|
|
using UnityEngine;
|
2020-12-02 12:42:26 +00:00
|
|
|
|
|
2020-12-04 22:14:53 +00:00
|
|
|
|
namespace QuantumUNET
|
2020-12-02 12:42:26 +00:00
|
|
|
|
{
|
2020-12-23 12:58:45 +00:00
|
|
|
|
public class QPlayerController
|
2020-12-02 12:42:26 +00:00
|
|
|
|
{
|
2020-12-03 11:56:32 +00:00
|
|
|
|
public short PlayerControllerId = -1;
|
2020-12-23 12:58:45 +00:00
|
|
|
|
public QNetworkIdentity UnetView;
|
2020-12-03 11:56:32 +00:00
|
|
|
|
public GameObject Gameobject;
|
|
|
|
|
public const int MaxPlayersPerClient = 32;
|
2020-12-16 09:08:38 +00:00
|
|
|
|
public bool IsValid => PlayerControllerId != -1;
|
2020-12-03 11:56:32 +00:00
|
|
|
|
|
|
|
|
|
internal const short kMaxLocalPlayers = 8;
|
|
|
|
|
|
2020-12-23 12:58:45 +00:00
|
|
|
|
public QPlayerController()
|
2020-12-02 12:42:26 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-23 12:58:45 +00:00
|
|
|
|
internal QPlayerController(GameObject go, short playerControllerId)
|
2020-12-02 12:42:26 +00:00
|
|
|
|
{
|
2020-12-03 11:56:32 +00:00
|
|
|
|
Gameobject = go;
|
2020-12-23 12:58:45 +00:00
|
|
|
|
UnetView = go.GetComponent<QNetworkIdentity>();
|
2020-12-03 11:56:32 +00:00
|
|
|
|
PlayerControllerId = playerControllerId;
|
2020-12-02 12:42:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-07-12 21:02:50 +00:00
|
|
|
|
public override string ToString() => string.Format("ID={0} NetworkIdentity NetID={1} Player={2}", new object[]
|
2020-12-02 12:42:26 +00:00
|
|
|
|
{
|
2020-12-03 11:56:32 +00:00
|
|
|
|
PlayerControllerId,
|
2020-12-20 23:50:24 +00:00
|
|
|
|
UnetView == null ? "null" : UnetView.NetId.ToString(),
|
|
|
|
|
Gameobject == null ? "null" : Gameobject.name
|
2020-12-02 12:42:26 +00:00
|
|
|
|
});
|
|
|
|
|
}
|
2020-12-03 08:28:05 +00:00
|
|
|
|
}
|