mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-17 01:13:05 +00:00
fix hud marker persisting after death
This commit is contained in:
parent
63518fd5f6
commit
243e709e89
@ -26,6 +26,16 @@ public class PlayerHUDMarker : HUDDistanceMarker
|
|||||||
_needsInitializing = true;
|
_needsInitializing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool ShouldBeVisible()
|
||||||
|
{
|
||||||
|
if (_player == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _player.IsReady && !_player.IsDead && !_player.InDreamWorld && _player.Visible;
|
||||||
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
if (_needsInitializing)
|
if (_needsInitializing)
|
||||||
@ -42,9 +52,9 @@ public class PlayerHUDMarker : HUDDistanceMarker
|
|||||||
{
|
{
|
||||||
var isVisible = _canvasMarker.IsVisible();
|
var isVisible = _canvasMarker.IsVisible();
|
||||||
|
|
||||||
if (_player.Visible != isVisible)
|
if (ShouldBeVisible() != isVisible)
|
||||||
{
|
{
|
||||||
_canvasMarker.SetVisibility(_player.Visible);
|
_canvasMarker.SetVisibility(ShouldBeVisible());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user