【M】Rokid工具扩展更改
This commit is contained in:
@@ -4,7 +4,7 @@ using Rokid.UXR.Interaction;
|
||||
using Stary.Evo;
|
||||
using UnityEngine;
|
||||
|
||||
public abstract class RKAddInteraction : MonoBehaviour
|
||||
public static class RKAddInteractionExtension
|
||||
{
|
||||
#region 触摸
|
||||
/// <summary>
|
||||
@@ -12,7 +12,7 @@ public abstract class RKAddInteraction : MonoBehaviour
|
||||
/// </summary>
|
||||
/// <param name="Touchedobject">被触碰物体</param>
|
||||
/// <param name="TouchEvent">触碰后事件</param>
|
||||
public virtual void ObjectAddTouchEvent(GameObject Touchedobject, System.Action<GameObject> TouchEvent, float TouchScale = 1.2f)
|
||||
public static void ObjectAddTouchEvent(this GameObject Touchedobject, System.Action<GameObject> TouchEvent, float TouchScale = 1.2f)
|
||||
{
|
||||
Collider ObjectCollider = Touchedobject.GetComponent<Collider>();
|
||||
GrabInteractable GrabInteractable = Touchedobject.GetComponent<GrabInteractable>();
|
||||
@@ -37,7 +37,7 @@ public abstract class RKAddInteraction : MonoBehaviour
|
||||
/// 暂停触摸事件
|
||||
/// </summary>
|
||||
/// <param name="Touchedobject">被触碰物体</param>
|
||||
public virtual void ObjectPauseTouchEvent(GameObject Touchedobject)
|
||||
public static void ObjectPauseTouchEvent(this GameObject Touchedobject)
|
||||
{
|
||||
Collider ObjectCollider = Touchedobject.GetComponent<Collider>();
|
||||
if (ObjectCollider != null)
|
||||
@@ -50,7 +50,7 @@ public abstract class RKAddInteraction : MonoBehaviour
|
||||
/// 恢复触摸事件
|
||||
/// </summary>
|
||||
/// <param name="Touchedobject">被触碰物体</param>
|
||||
public virtual void ObjectResumeTouchEvent(GameObject Touchedobject)
|
||||
public static void ObjectResumeTouchEvent(this GameObject Touchedobject)
|
||||
{
|
||||
Collider ObjectCollider = Touchedobject.GetComponent<Collider>();
|
||||
if (ObjectCollider != null)
|
||||
@@ -64,14 +64,14 @@ public abstract class RKAddInteraction : MonoBehaviour
|
||||
/// </summary>
|
||||
/// <param name="Touchedobject">被触碰物体</param>
|
||||
|
||||
public virtual void ObjectRemoveTouchEvent(GameObject Touchedobject)
|
||||
public static void ObjectRemoveTouchEvent(this GameObject Touchedobject)
|
||||
{
|
||||
GrabInteractable GrabInteractable = Touchedobject.GetComponent<GrabInteractable>();
|
||||
|
||||
if (GrabInteractable != null)
|
||||
{
|
||||
GrabInteractable.OnHoverBegin.RemoveAllListeners();
|
||||
Destroy(GrabInteractable);
|
||||
Object.Destroy(GrabInteractable);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public abstract class RKAddInteraction : MonoBehaviour
|
||||
/// </summary>
|
||||
/// <param name="Dragedobject">被拖动物体</param>
|
||||
/// <param name="DragingEvent">拖动时执行的方法</param>
|
||||
public virtual void objectAddDrag(GameObject Dragedobject, System.Action<GameObject> DragingEvent = null, float DragScale = 1.2f)
|
||||
public static void objectAddDrag(this GameObject Dragedobject, System.Action<GameObject> DragingEvent = null, float DragScale = 1.2f)
|
||||
{
|
||||
Collider ObjectCollider = Dragedobject.GetComponent<Collider>();
|
||||
GrabInteractable GrabInteractable = Dragedobject.GetComponent<GrabInteractable>();
|
||||
@@ -122,7 +122,7 @@ public abstract class RKAddInteraction : MonoBehaviour
|
||||
/// 暂停拖动
|
||||
/// </summary>
|
||||
/// <param name="Dragedobject"></param>
|
||||
public virtual void objectPauseDrag(GameObject Dragedobject)
|
||||
public static void objectPauseDrag(this GameObject Dragedobject)
|
||||
{
|
||||
Collider ObjectCollider = Dragedobject.GetComponent<Collider>();
|
||||
if (ObjectCollider!= null) ObjectCollider.enabled = false;
|
||||
@@ -132,21 +132,21 @@ public abstract class RKAddInteraction : MonoBehaviour
|
||||
/// 恢复拖动
|
||||
/// </summary>
|
||||
/// <param name="Dragedobject"></param>
|
||||
public virtual void objectResumeDrag(GameObject Dragedobject)
|
||||
public static void objectResumeDrag(this GameObject Dragedobject)
|
||||
{
|
||||
Collider ObjectCollider = Dragedobject.GetComponent<Collider>();
|
||||
if (ObjectCollider!= null) ObjectCollider.enabled = true;
|
||||
}
|
||||
|
||||
public virtual void objectRemoveDrag(GameObject Dragedobject)
|
||||
public static void objectRemoveDrag(this GameObject Dragedobject)
|
||||
{
|
||||
Throwable Throwable = Dragedobject.GetComponent<Throwable>();
|
||||
GrabInteractable GrabInteractable = Dragedobject.GetComponent<GrabInteractable>();
|
||||
if (Throwable != null) Destroy(Throwable);
|
||||
if (Throwable != null) Object.Destroy(Throwable);
|
||||
if (GrabInteractable != null)
|
||||
{
|
||||
GrabInteractable.OnHeldUpdate.RemoveAllListeners();
|
||||
Destroy(GrabInteractable);
|
||||
Object.Destroy(GrabInteractable);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "com.staryevo.rktools",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"displayName": "07.RKTools",
|
||||
"description": "Rokid工具",
|
||||
"unity": "2021.3",
|
||||
|
||||
Reference in New Issue
Block a user