using System.Collections; using System.Collections.Generic; using BigSpace.Logic; using BigSpace.XRCore.Event; using UnityEngine; public class CatchManager : MonoBehaviour { public Transform attachPoint; public Transform chuiziPoint; public bool start; public GrabItem m_currentItem; private Collider m_collider; public bool Start { get => start; set { start = value; if (value == false && m_currentItem != null) { SetCurrentItem(null); } } } private void Awake() { m_collider = GetComponent(); GlobalEventMgr.Listen(GameEvent.EventChangeScence, GameDataManage_EventChangeScence); } public void SetStart(bool value) { //Debug.Log("识别了抓取手势:"+value); Start = value; } public void SetCurrentItem(GrabItem item) { if(item == null) m_currentItem.OnReset(this.name); m_currentItem = item; m_collider.enabled = item ==null? true:false; } public void SetParent(Transform transform) { //if (transform.tag == "ChuiZi") //{ // transform.position = chuiziPoint.position; // transform.eulerAngles = chuiziPoint.eulerAngles; // transform.SetParent(chuiziPoint); //} //else //{ transform.position = attachPoint.position; transform.SetParent(attachPoint); //} } //切换场景删除手上物体 void GameDataManage_EventChangeScence() { foreach (Transform child in attachPoint) { Destroy(child.gameObject); } start = true; m_collider.enabled = true ; } }