using System.Collections; using System.Collections.Generic; using BigSpace.Logic; using BigSpace.XRCore.Event; using BigSpace.XRCore.RunningScene; using Unity.XR.PXR; using UnityEngine; using static Unity.VisualScripting.Member; using UnityEngine.UIElements; public class PlayJiaGuAnimator : MonoBehaviour { public List listAnimator; public GameObject handObj; public int HandType; public HandFontSelfCtr font; public GameObject catchJiaGu; public GameObject animatorJiaGu; public AudioSource audio_HuiDa; public GameObject audio_Wen; //����������ʾʱ�� bool oneIsRun = false; float oneWaitTime = 26f; float oneRunTime = 0; // Start is called before the first frame update void Start() { GlobalEventMgr.Listen(GameEvent.EventHideTuchJiaGu, GameDataManage_EventHideTuchJiaGu); } private void Update() { if (oneIsRun) { oneRunTime += Time.deltaTime; if (oneRunTime >= oneWaitTime) { oneIsRun = false; oneRunTime = 0; if (font != null) //��ʾ�� font.PlayShowJGWFont(); if (animatorJiaGu != null) animatorJiaGu.SetActive(false); if (catchJiaGu != null) catchJiaGu.SetActive(true); } } } [Header("��������")] [SerializeField] private List childAnimator; // ֱ���϶��� public void SetTriggerParameter(string parameterName) { for (int i = 0; i < childAnimator.Count; i++) { Destroy(childAnimator[i]); childAnimator[i] = null; } } private void OnTriggerEnter(Collider other) { if (other.gameObject.name == "PalmBox_L" || other.gameObject.name == "PalmBox_R") { if (listAnimator != null) { SetTriggerParameter("DisTrigger"); SceneMgr.Instance.isTrigger=true; for (int i = 0; i < listAnimator.Count; i++) { if (HandType == 1) { listAnimator[i].Play("shaohuo_L"); } else { listAnimator[i].Play("shaohuo_R"); } } } oneIsRun = true; GlobalEventMgr.Dispatch(GameEvent.EventHideTuchJiaGu); //ֻ����һ�Σ��ر����еĿɴ����׹���ײ if (audio_HuiDa != null) { audio_HuiDa.Play(); } } } void GameDataManage_EventHideTuchJiaGu() { this.GetComponent().enabled = false; if (handObj != null) { handObj.SetActive(false); } if (audio_Wen != null) audio_Wen.SetActive(false); } }