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,53 @@
using UnityEngine;
using Unheimlich.Features.Hallucination;
using Unheimlich.Features.Dialogue.UI;
namespace Unheimlich.World.Environment
{
/// <summary>
/// Sits on each stair-segment prefab and acts as the single configuration point
/// for the InfiniteStaircaseController.
///
/// Responsibilities:
/// - Holds a reference to the segment's FloatingLabel (set in prefab).
/// - Holds a reference to the segment's HallucinationTriggerZone (set in prefab).
/// - Exposes Configure() so the controller can push the right word and event
/// at spawn time without any GetComponent chains on the controller side.
/// </summary>
public class StaircaseSegment : MonoBehaviour
{
[Header("References")]
[Tooltip("FloatingLabel present on this prefab. Assign in the prefab inspector.")]
[SerializeField] private FloatingLabel _floatingLabel;
[Tooltip("HallucinationTriggerZone present on this prefab. Assign in the prefab inspector.")]
[SerializeField] private HallucinationTriggerZone _triggerZone;
// ─── Public API ────────────────────────────────────────────────────────
/// <summary>
/// Called by InfiniteStaircaseController right after this segment is spawned.
/// Sets the word on the FloatingLabel and overrides the HallucinationEvent on the zone.
/// </summary>
/// <param name="word">Text to display. Null or empty = label keeps its prefab default.</param>
/// <param name="hallucinationEvent">Event to fire when the player enters the zone. Null = no event.</param>
public void Configure(string word, HallucinationEvent hallucinationEvent)
{
if (_floatingLabel != null && !string.IsNullOrEmpty(word))
_floatingLabel.SetText(word);
if (_triggerZone != null)
_triggerZone.SetEvent(hallucinationEvent);
}
// ─── Editor helpers ────────────────────────────────────────────────────
#if UNITY_EDITOR
private void Reset()
{
_floatingLabel = GetComponentInChildren<FloatingLabel>();
_triggerZone = GetComponentInChildren<HallucinationTriggerZone>();
}
#endif
}
}