Unity Udexreal开发插件包
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.4 KiB

using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using UDE_HAND_INTERACTION;
using Unity.VisualScripting;
using UnityEngine;
using DG.Tweening;
public class BellSample : MonoBehaviour
{
private InteractableObject ObjectManager;
// Start is called before the first frame update
void Start()
{
ObjectManager = GetComponent<InteractableObject>();
}
// Update is called once per frame
void Update()
{
}
private void OnTriggerEnter(Collider other)
{
if (!ObjectManager.IsFollow) return;
if (other.name == "BellDetectArea")
{
var OtherInteractObj = other.GetComponent<InteractableObject>();
transform.parent = other.transform;
transform.DOLocalMove(Vector3.zero, 0.2f);
transform.DOLocalRotate(Vector3.zero, 0.2f);
ObjectManager.SwitchHandInteractioinPlan(1);
if (ObjectManager.Hand.name[0] == 'L')
{
ObjectManager.Hand.GetComponent<HandInteractor>().ForceActive(ObjectManager, ObjectManager.HandInteractions[0]);
}
else
{
ObjectManager.Hand.GetComponent<HandInteractor>().ForceActive(ObjectManager, ObjectManager.HandInteractions[1]);
}
other.GetComponentInParent<InteractableObject>().SwitchHandInteractioinPlan(1);
}
}
}