quantum-space-buddies/QSB/Player/PlayerSyncObject.cs

14 lines
503 B
C#
Raw Normal View History

2021-03-09 16:44:14 +00:00
using QuantumUNET;
2020-11-03 21:33:48 +00:00
namespace QSB.Player
{
2020-12-23 12:58:45 +00:00
public abstract class PlayerSyncObject : QNetworkBehaviour
2020-12-02 21:29:53 +00:00
{
2020-12-12 18:14:04 +00:00
public uint AttachedNetId => NetIdentity?.NetId.Value ?? uint.MaxValue;
public uint PlayerId => NetIdentity.RootIdentity?.NetId.Value ?? NetIdentity.NetId.Value;
2020-12-02 21:29:53 +00:00
public PlayerInfo Player => QSBPlayerManager.GetPlayer(PlayerId);
2020-12-14 16:04:16 +00:00
2020-12-14 19:23:24 +00:00
protected virtual void Start() => QSBPlayerManager.AddSyncObject(this);
2021-03-09 16:43:41 +00:00
protected virtual void OnDestroy() => QSBPlayerManager.RemoveSyncObject(this);
2020-12-02 21:29:53 +00:00
}
2020-12-03 08:28:05 +00:00
}