quantum-space-buddies/QSB/Utility/UnetExtensions.cs

17 lines
406 B
C#
Raw Normal View History

2020-12-02 08:29:32 +00:00
using QSB.Player;
using QSB.TransformSync;
using UnityEngine.Networking;
namespace QSB.Utility
{
public static class UnetExtensions
{
2020-12-02 18:40:38 +00:00
public static PlayerInfo GetPlayer(this QSBNetworkConnection connection)
2020-12-02 08:29:32 +00:00
{
2020-12-02 18:40:38 +00:00
var go = connection.PlayerControllers[0].gameObject;
2020-12-02 08:29:32 +00:00
var controller = go.GetComponent<PlayerTransformSync>();
2020-12-02 09:51:53 +00:00
return QSBPlayerManager.GetPlayer(controller.NetId.Value);
2020-12-02 08:29:32 +00:00
}
}
}