quantum-space-buddies/QSB/HUD/PlanetTrigger.cs

35 lines
765 B
C#
Raw Permalink Normal View History

2023-02-10 12:01:31 +00:00
using QSB.HUD.Messages;
using QSB.Messaging;
using QSB.Utility;
namespace QSB.HUD;
public class PlanetTrigger : SectoredMonoBehaviour
{
public HUDIcon Icon;
public override void OnSectorOccupantAdded(SectorDetector detector)
{
if (detector.GetOccupantType() != DynamicOccupant.Player)
{
return;
}
MultiplayerHUDManager.HUDIconStack.Push(Icon);
2023-07-07 18:23:19 +00:00
var top = MultiplayerHUDManager.HUDIconStack.PeekFront();
2023-02-10 12:01:31 +00:00
new PlanetMessage(top).Send();
}
public override void OnSectorOccupantRemoved(SectorDetector detector)
{
if (detector.GetOccupantType() != DynamicOccupant.Player)
{
return;
}
MultiplayerHUDManager.HUDIconStack.Remove(Icon);
2023-07-07 18:23:19 +00:00
var top = MultiplayerHUDManager.HUDIconStack.PeekFront();
2023-02-10 12:01:31 +00:00
new PlanetMessage(top).Send();
}
}