This commit is contained in:
kridoo
2025-11-19 23:51:17 +08:00
parent 0ba6ef05dd
commit 6019406bc8
16 changed files with 375 additions and 72 deletions

View File

@@ -67,11 +67,15 @@ public class HandCatchFontCtr : MonoBehaviour
if (rightRunTime >= rightWaitTime)
{
isRightStartStay = false;
GlobalEventMgr.Dispatch(GameEvent.EventRayStart, 2);//2:<3A><><EFBFBD><EFBFBD>
GlobalEventMgr.Dispatch(GameEvent.EventRayStart,2);//2:<3A><><EFBFBD><EFBFBD>
}
}
}
public void RightHandPosCatchReset()
{
isRightStartStay = false;
rightRunTime = 0;
}
public void RightHandPosCatchEnd(bool isShow)
{
isRightStartStay = false;

View File

@@ -14,6 +14,7 @@ public class NengNiangQiuCtr : MonoBehaviour
// 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);

View File

@@ -30,12 +30,16 @@ public class CatchManager : MonoBehaviour
m_collider = GetComponent<Collider>();
GlobalEventMgr.Listen(GameEvent.EventChangeScence, GameDataManage_EventChangeScence);
}
public void SetStart(bool value)
{
//Debug.Log("ʶ<><CAB6><EFBFBD><EFBFBD>ץȡ<D7A5><C8A1><EFBFBD><EFBFBD>:"+value);
Start = value;
}
public void SetEnd(bool value)
{
Start = value;
}
public void SetCurrentItem(GrabItem item)
{
if(item == null)

View File

@@ -2,6 +2,8 @@ using System.Collections;
using System.Collections.Generic;
using BigSpace.Logic;
using BigSpace.XRCore.Event;
using RenderHeads.Media.AVProVideo;
using Unity.XR.PXR;
using UnityEngine;
public class SelfCharacterControllCtr : MonoBehaviour
@@ -9,18 +11,13 @@ public class SelfCharacterControllCtr : MonoBehaviour
public GameObject bodyBox;
CharacterController characterCtr;
// Start is called before the first frame update
void Start()
{
GlobalEventMgr.Listen<bool>(GameEvent.EventSetReadyCatchAnimal, GameDataManage_EventSetReadyCatchAnimal);
characterCtr = GetComponent<CharacterController>();
}
// Update is called once per frame
void Update()
{
}
void GameDataManage_EventSetReadyCatchAnimal(bool isShow)
{
if (isShow)
@@ -36,3 +33,6 @@ public class SelfCharacterControllCtr : MonoBehaviour
}
}

View File

@@ -29,14 +29,8 @@ public class LeavePlayPrefabControll : MonoBehaviour
//GameObject staticObj = gameScene.transform.Find("Static").gameObject;
//gameScene.transform.Find("Static").gameObject.SetActive(false);
//Renderer[] renderers = staticObj.GetComponentsInChildren<Renderer>();
//for (int i = 0; i < renderers.Length-1; i++)
//{
// renderers[i].enabled = false;
//}
//gameScene.transform.Find("Dynamic").gameObject.SetActive(false);
SetObjsRender(false);
GameObject gameEnvi = GameObject.Find("GameScene/Environment/SkyBox_360Player");
SetGameObjectLayer(gameEnvi, false);
leavePrefab.transform.position = new Vector3(v3.x, 0, v3.z);
@@ -64,16 +58,22 @@ public class LeavePlayPrefabControll : MonoBehaviour
boxCollider.transform.localScale = new Vector3(1, 1, 1.5f);
//block.SetActive(true);
}
public void SetObjsRender(bool isActive)
{
GameObject gameScene = GameObject.Find("GameScene");
GameObject staticObj = gameScene.transform.Find("Static").gameObject;
GameObject Dog_Root = GameObject.Find("GameScene/Dynamic/Character/Dog_Root");
if (Dog_Root!=null)
{
Dog_Root.gameObject.SetActive(isActive);
}
// 使用递归方法获取所有子物体的Renderer组件
List<Renderer> staticRenderers = GetAllRenderersRecursive(staticObj);
for (int i = 0; i < staticRenderers.Count; i++)
{
staticRenderers[i].enabled = isActive;
}
GameObject dynamicObj = gameScene.transform.Find("Dynamic").gameObject;
@@ -153,25 +153,15 @@ public class LeavePlayPrefabControll : MonoBehaviour
return;
}
// 检查是否有碰撞器或触发器,如果有则跳过该节点,保持原状
Collider collider = parent.GetComponent<Collider>();
if (collider != null)
{
// 如果节点上有碰撞器或触发器跳过该节点的Renderer继续遍历子物体
foreach (Transform child in parent)
{
GetAllRenderersRecursive(child, renderers, includeInactive);
}
return;
}
// 获取当前物体的Renderer组件
Renderer renderer = parent.GetComponent<Renderer>();
if (renderer != null)
{
renderers.Add(renderer);
}
// 递归遍历所有子物体
foreach (Transform child in parent)
{

View File

@@ -22,16 +22,16 @@ public class AnimalCatchCtr : MonoBehaviour
//<2F><><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD>ץ<EFBFBD>ŵ<EFBFBD><C5B5><EFBFBD><EFBFBD><EFBFBD>
public void LeftHandPosCatch(bool isShow)
{
if (isShow)
{
GlobalEventMgr.Dispatch(GameEvent.EventRayStart,1);//1:<3A><><EFBFBD><EFBFBD>
//Debug.Log("ץȡ<D7A5><C8A1><EFBFBD><EFBFBD>ʶ<EFBFBD><CAB6><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
}
else
{
//Debug.Log("<22>ɿ<EFBFBD><C9BF><EFBFBD><EFBFBD><EFBFBD>ʶ<EFBFBD><CAB6><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
//GlobalEventMgr.Dispatch(GameEvent.EventRayQuadOk, false,1);
}
//if (isShow)
//{
// GlobalEventMgr.Dispatch(GameEvent.EventRayStart,1);//1:<3A><><EFBFBD><EFBFBD>
// //Debug.Log("ץȡ<D7A5><C8A1><EFBFBD><EFBFBD>ʶ<EFBFBD><CAB6><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
//}
//else
//{
// //Debug.Log("<22>ɿ<EFBFBD><C9BF><EFBFBD><EFBFBD><EFBFBD>ʶ<EFBFBD><CAB6><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
// //GlobalEventMgr.Dispatch(GameEvent.EventRayQuadOk, false,1);
//}
}
//<2F><><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD>ץ<EFBFBD>ŵ<EFBFBD><C5B5><EFBFBD><EFBFBD><EFBFBD>
@@ -52,12 +52,12 @@ public class AnimalCatchCtr : MonoBehaviour
//<2F><><EFBFBD><EFBFBD>ץȡ<D7A5><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public void LeftHandCatchPalmUp(bool isShowFont)
{
if (isShowFont)
{
Debug.Log("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϻ<EFBFBD>ȡ<EFBFBD><C8A1>:"+ AnimalCatchMgr.Instance.leftHandIsCatchObj);
//if(AnimalCatchMgr.Instance.handIsCatchObj)
GlobalEventMgr.Dispatch(GameEvent.EventHandShowFont,1, AnimalCatchMgr.Instance.leftAnimalType);
}
//if (isShowFont)
//{
// Debug.Log("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϻ<EFBFBD>ȡ<EFBFBD><C8A1>:"+ AnimalCatchMgr.Instance.leftHandIsCatchObj);
// //if(AnimalCatchMgr.Instance.handIsCatchObj)
// GlobalEventMgr.Dispatch(GameEvent.EventHandShowFont,1, AnimalCatchMgr.Instance.leftAnimalType);
//}
}
//<2F><><EFBFBD><EFBFBD>ץȡ<D7A5><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>

View File

@@ -29,6 +29,8 @@ public class RayCtr : MonoBehaviour
void Start()
{
GlobalEventMgr.Listen<int>(GameEvent.EventRayStart, GameDataManage_EventRayStart);
GlobalEventMgr.Listen<int>(GameEvent.EventHandRelease, GameDataManage_EventHandRelease);
//// <20><><EFBFBD><EFBFBD>LineRenderer<65><72><EFBFBD><EFBFBD>
//lineRenderer = gameObject.AddComponent<LineRenderer>();
@@ -62,7 +64,7 @@ public class RayCtr : MonoBehaviour
// lineRenderer.endColor = rayColor;
// }
//}
// Update is called once per frame
void Update()
{
@@ -74,20 +76,16 @@ public class RayCtr : MonoBehaviour
{
Debug.DrawRay(transform.position, transform.forward * rayLength, Color.red);
Ray ray;
if (SceneMgr.Instance.nowSceneId == 2)
{
ray = new Ray(transform.position, transform.forward);
}
else
{
var Cam = Camera.main;
ray = new Ray(Cam.transform.position, Cam.transform.forward);
ray = new Ray(transform.position, transform.forward);
Ray ray2;
var Cam = Camera.main;
ray2 = new Ray(Cam.transform.position, Cam.transform.forward);
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
RaycastHit hit; // <20><EFBFBD><E6B4A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ײ<EFBFBD><D7B2>Ϣ
//Debug.Log("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>......<2E><>1<EFBFBD><31>");
if (Physics.Raycast(ray, out hit, rayLength, detectionLayer))
if (Physics.Raycast(ray, out hit, rayLength, detectionLayer)&& Physics.Raycast(ray2, out hit, rayLength, detectionLayer))
{
GameObject hitObject = hit.collider.gameObject; // <20><>ȡ<EFBFBD><C8A1>ײ<EFBFBD><D7B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
@@ -95,7 +93,7 @@ public class RayCtr : MonoBehaviour
if ("Quad" == hitObject.name.Substring(0, 4))
{
fontIndex = int.Parse(hitObject.name.Substring(4));
Debug.Log("<22><><EFBFBD>˵ڼ<CBB5><DABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>......" + fontIndex);
//Debug.Log("<22><><EFBFBD>˵ڼ<CBB5><DABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>......" + fontIndex);
starRay = false;
isRun = false;
runTime = 0;
@@ -128,5 +126,15 @@ public class RayCtr : MonoBehaviour
runTime = 0;
}
}
void GameDataManage_EventHandRelease(int type)
{
//Debug.Log("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:"+type);
if (myhandType == type)
{
starRay = false;
isRun = false;
runTime = 0;
}
}
}

View File

@@ -6,7 +6,7 @@ using BigSpace.XRCore.Scene;
using System;
using BigSpace.XRCore.Event;
using BigSpace.Logic;
using Unity.XR.PXR;
public class SceneMgr : MonoSingleton<SceneMgr>
{
private Coroutine _currentCoroutine; // <20><>ǰ<EFBFBD><C7B0><EFBFBD>ڽ<EFBFBD><DABD>еij<D0B5><C4B3><EFBFBD><EFBFBD>л<EFBFBD>Э<EFBFBD><D0AD>
@@ -15,6 +15,7 @@ public class SceneMgr : MonoSingleton<SceneMgr>
public int nowSceneId = 0; //<2F><>ǰ<EFBFBD><C7B0>ʽ<EFBFBD>ij<EFBFBD><C4B3><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD>ȳ<EFBFBD><C8B3><EFBFBD>)
public bool isCanMove = true;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD><D6B1>߶<EFBFBD>
public bool isTrigger = false;
public bool handisactive = false;
/// <summary>
/// <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/// </summary>
@@ -29,7 +30,7 @@ public class SceneMgr : MonoSingleton<SceneMgr>
{
SceneManager.sceneLoaded += OnSceneLoaded;
}
private void OnSceneLoaded(Scene arg0, LoadSceneMode arg1)
{