mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-11 00:52:19 +00:00
0132c40760
* Bad fix for player names
47 lines
1.0 KiB
C#
47 lines
1.0 KiB
C#
using UnityEngine;
|
|
|
|
namespace QSB.TransformSync
|
|
{
|
|
public class PlayerHUDMarker : HUDDistanceMarker
|
|
{
|
|
private PlayerInfo _player;
|
|
private bool _isReady;
|
|
|
|
protected override void InitCanvasMarker()
|
|
{
|
|
_markerRadius = 2f;
|
|
|
|
_markerTarget = new GameObject().transform;
|
|
_markerTarget.parent = transform;
|
|
|
|
_markerTarget.localPosition = Vector3.up * 2;
|
|
}
|
|
|
|
public void Init(PlayerInfo player)
|
|
{
|
|
_player = player;
|
|
_isReady = true;
|
|
}
|
|
|
|
protected override void RefreshOwnVisibility()
|
|
{
|
|
if (_canvasMarker != null)
|
|
{
|
|
_canvasMarker.SetVisibility(true);
|
|
}
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (!_isReady || !_player.IsReady)
|
|
{
|
|
return;
|
|
}
|
|
_markerLabel = _player.Name;
|
|
_isReady = false;
|
|
|
|
base.InitCanvasMarker();
|
|
}
|
|
}
|
|
}
|