UI/LockpickerBus.cs

Static UI helper for a lockpicking minigame. It stores whether the lockpicker UI is open, generates a randomized correct angle for the current attempt, and exposes an OnOpen event that UI or game code can subscribe to.

Networking
using System;

namespace BrickJam.UI;

/// <summary>
/// Decouples gameplay from the Razor <c>Lockpicker</c> panel. The interaction flow asks the local
/// client to open the minigame; the panel runs it and reports success back through the player.
/// <see cref="IsOpen"/> also gates player movement/look while picking.
/// </summary>
public static class LockpickerBus
{
	public static bool IsOpen { get; set; }

	/// <summary>The randomized sweet-spot angle (degrees) for the current attempt.</summary>
	public static float CorrectAngle { get; private set; }

	public static event Action OnOpen;

	public static void Open()
	{
		CorrectAngle = Random.Shared.NextSingle() * 360f;
		IsOpen = true;
		OnOpen?.Invoke();
	}
}