mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2024-12-29 03:28:26 +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;
|
||||
}
|
||||
|
||||
private bool ShouldBeVisible()
|
||||
{
|
||||
if (_player == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return _player.IsReady && !_player.IsDead && !_player.InDreamWorld && _player.Visible;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (_needsInitializing)
|
||||
@ -42,9 +52,9 @@ public class PlayerHUDMarker : HUDDistanceMarker
|
||||
{
|
||||
var isVisible = _canvasMarker.IsVisible();
|
||||
|
||||
if (_player.Visible != isVisible)
|
||||
if (ShouldBeVisible() != isVisible)
|
||||
{
|
||||
_canvasMarker.SetVisibility(_player.Visible);
|
||||
_canvasMarker.SetVisibility(ShouldBeVisible());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user