Files
PrinceOfGlory/Assets/Scripts/Hand/NengNiangQiuCtr.cs
kridoo 434fc18578 1
2025-11-04 13:56:54 +08:00

74 lines
2.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Collections;
using System.Collections.Generic;
using BigSpace.Logic;
using BigSpace.XRCore.Event;
using Unity.XR.PXR;
using UnityEngine;
public class NengNiangQiuCtr : MonoBehaviour
{
public GameObject nengniangquObj_L;
public GameObject nengniangquObj_R;
int _handType;
int _fontIndex;
// Start is called before the first frame update
void Start()
{
GlobalEventMgr.Listen<bool, int, int>(GameEvent.EventRayQuadOk, GameDataManage_EventRayQuadOk);
GlobalEventMgr.Listen<int>(GameEvent.EventHandRelease, GameDataManage_EventHandRelease);
GlobalEventMgr.Listen(GameEvent.EventHideCatchFont, GameDataManage_EventHideCatchFont);
}
// Update is called once per frame
void GameDataManage_EventRayQuadOk(bool isCatchOk, int handType, int fontIndex)
{
if (!SceneMgr.Instance.isTrigger)
{
_handType = handType;
_fontIndex = fontIndex;
if (_handType == 1)
{
nengniangquObj_L.SetActive(true);
}
else
{
nengniangquObj_R.SetActive(true);
}
}
}
void GameDataManage_EventHandRelease(int handType)
{
if (!SceneMgr.Instance.isTrigger)
{
if (handType == 1)
{
if (nengniangquObj_L.activeSelf)
{
nengniangquObj_L.SetActive(false);
//在手的位置显示字
GlobalEventMgr.Dispatch(GameEvent.EventShowCatchFont, true, _handType, _fontIndex);//1左手
}
}
else
{
if (nengniangquObj_R.activeSelf)
{
nengniangquObj_R.SetActive(false);
//在手的位置显示字
GlobalEventMgr.Dispatch(GameEvent.EventShowCatchFont, true, _handType, _fontIndex);//2:右手
}
}
}
}
void GameDataManage_EventHideCatchFont()
{
nengniangquObj_R.SetActive(false);
nengniangquObj_L.SetActive(false);
}
}