106 lines
3.0 KiB
C#
106 lines
3.0 KiB
C#
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<Animator> listAnimator;
|
||
public GameObject handObj;
|
||
public int HandType;
|
||
public HandFontSelfCtr font;
|
||
|
||
public GameObject catchJiaGu;
|
||
public GameObject animatorJiaGu;
|
||
public AudioSource audio_HuiDa;
|
||
public GameObject audio_Wen;
|
||
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾʱ<CABE><CAB1>
|
||
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) //<2F><>ʾ<EFBFBD><CABE>
|
||
font.PlayShowJGWFont();
|
||
if (animatorJiaGu != null)
|
||
animatorJiaGu.SetActive(false);
|
||
if (catchJiaGu != null)
|
||
catchJiaGu.SetActive(true);
|
||
}
|
||
}
|
||
}
|
||
[Header("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")]
|
||
[SerializeField] private List<GameObject> childAnimator; // ֱ<><D6B1><EFBFBD>϶<EFBFBD><CFB6><EFBFBD>
|
||
|
||
public void SetTriggerParameter(string parameterName)
|
||
{
|
||
for (int i = 0; i < childAnimator.Count; i++)
|
||
{
|
||
childAnimator[i].transform.localScale = Vector3.zero;
|
||
}
|
||
}
|
||
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); //ֻ<><D6BB><EFBFBD><EFBFBD>һ<EFBFBD>Σ<EFBFBD><CEA3>ر<EFBFBD><D8B1><EFBFBD><EFBFBD>еĿɴ<C4BF><C9B4><EFBFBD><EFBFBD><EFBFBD><D7B9><EFBFBD>ײ
|
||
if (audio_HuiDa != null)
|
||
{
|
||
audio_HuiDa.Play();
|
||
|
||
}
|
||
|
||
}
|
||
|
||
}
|
||
|
||
void GameDataManage_EventHideTuchJiaGu()
|
||
{
|
||
this.GetComponent<BoxCollider>().enabled = false;
|
||
if (handObj != null)
|
||
{
|
||
handObj.SetActive(false);
|
||
}
|
||
if (audio_Wen != null)
|
||
audio_Wen.SetActive(false);
|
||
}
|
||
}
|