mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-26 18:35:34 +00:00
18a520bc78
* cleanup
47 lines
1.0 KiB
C#
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();
|
|
}
|
|
}
|
|
}
|