quantum-space-buddies/QSB/HUD/PlanetTrigger.cs
2023-07-07 19:23:19 +01:00

35 lines
765 B
C#

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);
var top = MultiplayerHUDManager.HUDIconStack.PeekFront();
new PlanetMessage(top).Send();
}
public override void OnSectorOccupantRemoved(SectorDetector detector)
{
if (detector.GetOccupantType() != DynamicOccupant.Player)
{
return;
}
MultiplayerHUDManager.HUDIconStack.Remove(Icon);
var top = MultiplayerHUDManager.HUDIconStack.PeekFront();
new PlanetMessage(top).Send();
}
}