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

42 lines
699 B
C#
Raw Normal View History

2025-01-21 20:58:56 +00:00
using Godot;
using System.Collections;
using System.Collections.Generic;
using Godot.Collections;
namespace Rokojori
{
[GlobalClass,Icon("res://addons/rokojori_action_library/Icons/Grabbable.svg")]
public partial class Grabbable:Node3D
{
[Export]
public Action onGrab;
[Export]
public Action onRelease;
[Export]
public Node3D grabTarget;
[ExportGroup("Read Only")]
[Export]
public Grabber grabber;
public void SetGrabber( Grabber grabber )
{
this.grabber = grabber;
if ( this.grabber != null )
{
Action.Trigger( onGrab );
}
else
{
Action.Trigger( onRelease );
}
}
}
}