rj-action-library/Runtime/Interactions/Interactor.cs

35 lines
640 B
C#
Raw Normal View History

2025-01-18 12:49:14 +00:00
using Godot;
using System.Collections;
using System.Collections.Generic;
using Godot.Collections;
namespace Rokojori
{
[GlobalClass]
public partial class Interactor:Node3D, SensorInputHandler
{
[Export]
public Pointer pointer;
[Export]
public Sensor button;
public void _OnSensor( SensorEvent se )
{
if ( pointer == null || pointer.pointable == null )
{
return;
}
var interactable = Nodes.Find<Interactable>( pointer.pointable.GetParent() );
if ( interactable == null )
{
return;
}
Action.Trigger( interactable.onInteraction );
}
}
}