using System.Collections.Generic; using System.ComponentModel; using Godot; using Godot.Bridge; using Godot.NativeInterop; [ScriptPath("res://Scripts/DangerZone.cs")] public partial class DangerZone : Area2D { [Export(PropertyHint.None, "")] private Node2D visibleBarriers; public bool inside; public override void _EnterTree() { base.BodyEntered += OnTriggerEnter; base.BodyExited += OnTriggerExit; if (visibleBarriers != null) { visibleBarriers.Modulate = Main.colorClear; } } public override void _Process(double delta) { if (inside) { Player.instance.dangerZoneCD = 5f; if (visibleBarriers != null) { visibleBarriers.Modulate = visibleBarriers.Modulate.Lerp(Main.colorWhite, 0.1f); } } else if (visibleBarriers != null) { visibleBarriers.Modulate = visibleBarriers.Modulate.Lerp(Main.colorClear, 0.1f); } } private void OnTriggerEnter(Node other) { if (other is Player && Player.instance.canInput) { inside = true; Player.instance.UpdateOverlay(); } } private void OnTriggerExit(Node other) { if (other is Player) { inside = false; } } }