37 lines
871 B
C#
37 lines
871 B
C#
using RTG;
|
|
using UnityEngine;
|
|
using XRLib;
|
|
|
|
namespace XED.Machine
|
|
{
|
|
public class NodeGizmoController : MonoBehaviour,ISingle
|
|
{
|
|
public ObjectTransformGizmo moveGizmo;
|
|
public GameObject target;
|
|
|
|
// Start is called before the first frame update
|
|
void Awake()
|
|
{
|
|
moveGizmo = RTGizmosEngine.Get.CreateObjectMoveGizmo();
|
|
moveGizmo.Gizmo.SetEnabled(false);
|
|
}
|
|
|
|
public void Attach(GameObject target)
|
|
{
|
|
moveGizmo.Gizmo.SetEnabled(true);
|
|
this.target = target.gameObject;
|
|
moveGizmo.SetTargetObject(target);
|
|
}
|
|
public void Detach()
|
|
{
|
|
moveGizmo.Gizmo.SetEnabled(false);
|
|
target = null;
|
|
}
|
|
|
|
internal bool GetGizmoHover()
|
|
{
|
|
return moveGizmo.Gizmo.IsHovered;
|
|
}
|
|
}
|
|
}
|