66 lines
1.9 KiB
C#
66 lines
1.9 KiB
C#
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)
|
||
{
|
||
_handType = handType;
|
||
_fontIndex = fontIndex;
|
||
if (_handType == 1)
|
||
{
|
||
nengniangquObj_L.SetActive(true);
|
||
}
|
||
else
|
||
{
|
||
nengniangquObj_R.SetActive(true);
|
||
}
|
||
}
|
||
|
||
void GameDataManage_EventHandRelease(int handType)
|
||
{
|
||
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);
|
||
}
|
||
}
|