Hallucination system setup & implementation with the infinite staircase + Fake volumetric lights test

This commit is contained in:
Ferlat Thibaud
2026-03-27 20:47:11 +01:00
parent 34d8ffd5b0
commit 395f6266d6
119 changed files with 44996 additions and 816 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);
}
}
}
}