using Godot; using Rokojori; namespace GameJam { [GlobalClass] public partial class OnCollision:Node { [Export] public Area3D area; [Export] public RJAction onEntered; [Export] public RJAction onExit; public override void _Ready() { if ( area == null ) { return; } area.AreaEntered += ev => { TriggerOnEnter(); }; area.BodyEntered += ev => { TriggerOnEnter(); }; area.AreaExited += ev => { TriggerOnExited(); }; area.BodyExited += ev => { TriggerOnExited(); }; } void TriggerOnEnter() { Actions.Trigger( onEntered ); } void TriggerOnExited() { Actions.Trigger( onExit ); } } }