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

42 lines
699 B
C#

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 );
}
}
}
}