chore: Project Restructuring & Theatre

This commit is contained in:
Alexandre Coirier
2026-05-13 12:24:48 +02:00
parent 4070916c1f
commit e96d0bf6e6
2145 changed files with 20957 additions and 44792 deletions
@@ -0,0 +1,35 @@
using System.Collections.Generic;
using UnityEngine;
using Unheimlich.Features.Dialogue.UI;
namespace Unheimlich.Features.Hallucination
{
/// <summary>
/// Static registry that FloatingLabel instances self-register into on OnEnable/OnDisable.
/// Lets HallucinationManager iterate active labels in a radius without any FindObjectsOfType.
/// </summary>
public static class HallucinationLabelRegistry
{
private static readonly HashSet<FloatingLabel> _labels = new();
public static void Register(FloatingLabel label) => _labels.Add(label);
public static void Unregister(FloatingLabel label) => _labels.Remove(label);
/// <summary>
/// Returns all registered labels whose transform is within <paramref name="radius"/>
/// of <paramref name="center"/>. Results are written into <paramref name="results"/>
/// (which is cleared first) to avoid allocations per call.
/// </summary>
public static void GetLabelsInRadius(Vector3 center, float radius, List<FloatingLabel> results)
{
results.Clear();
float sqrRadius = radius * radius;
foreach (FloatingLabel label in _labels)
{
if (label == null) continue;
if ((label.transform.position - center).sqrMagnitude <= sqrRadius)
results.Add(label);
}
}
}
}