AmazingAlek 18a520bc78
cleanup (#99)
* cleanup
2020-07-28 14:59:24 +01:00

47 lines
1.0 KiB
C#

using UnityEngine;
namespace QSB.TransformSync
{
public class PlayerHUDMarker : HUDDistanceMarker
{
private uint _netId = uint.MaxValue;
private bool _isReady;
protected override void InitCanvasMarker()
{
_markerRadius = 2f;
_markerTarget = new GameObject().transform;
_markerTarget.parent = transform;
_markerTarget.localPosition = Vector3.zero;
}
public void SetId(uint netId)
{
_netId = netId;
_isReady = true;
}
protected override void RefreshOwnVisibility()
{
if (_canvasMarker != null)
{
_canvasMarker.SetVisibility(true);
}
}
private void Update()
{
if (!_isReady || !PlayerRegistry.IsPlayerReady(_netId))
{
return;
}
_markerLabel = PlayerRegistry.GetPlayerName(_netId);
_isReady = false;
base.InitCanvasMarker();
}
}
}