using UnityEngine; namespace KirbyAdventures { /// /// Village gate that opens when hit by Light after the ability is unlocked. /// public class LightGate : MonoBehaviour, ILightReactive { public bool IsOpen { get; private set; } public Transform GateVisual; public float OpenHeight = 4f; public float OpenSpeed = 2.5f; Vector3 _closedPos; Vector3 _openPos; bool _opening; void Awake() { if (GateVisual == null) GateVisual = transform; _closedPos = GateVisual.localPosition; _openPos = _closedPos + Vector3.up * OpenHeight; } public void OnHitByLight(Vector3 hitPoint, Vector3 direction) { if (IsOpen) return; if (GameFlow.Instance != null && !GameFlow.Instance.LightAbilityUnlocked) { DialogueUI.ShowTemporary("Свет ещё спит внутри... Найди источник на тропе.", 3f); return; } IsOpen = true; _opening = true; DialogueUI.ShowTemporary("Свет коснулся ворот — путь в деревню открыт.", 3.5f); if (GameFlow.Instance != null) GameFlow.Instance.TriggerWin(); } void Update() { if (!_opening || GateVisual == null) return; GateVisual.localPosition = Vector3.MoveTowards( GateVisual.localPosition, _openPos, OpenSpeed * Time.unscaledDeltaTime); } } }