1
This commit is contained in:
@@ -17,44 +17,52 @@ public class NengNiangQiuCtr : MonoBehaviour
|
||||
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)
|
||||
if (!SceneMgr.Instance.isTrigger)
|
||||
{
|
||||
nengniangquObj_L.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
nengniangquObj_R.SetActive(true);
|
||||
_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 (!SceneMgr.Instance.isTrigger)
|
||||
{
|
||||
if (nengniangquObj_L.activeSelf)
|
||||
if (handType == 1)
|
||||
{
|
||||
nengniangquObj_L.SetActive(false);
|
||||
//<2F><><EFBFBD>ֵ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>
|
||||
GlobalEventMgr.Dispatch(GameEvent.EventShowCatchFont, true, _handType, _fontIndex);//1<><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nengniangquObj_R.activeSelf)
|
||||
{
|
||||
nengniangquObj_R.SetActive(false);
|
||||
//<2F><><EFBFBD>ֵ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>
|
||||
GlobalEventMgr.Dispatch(GameEvent.EventShowCatchFont, true, _handType, _fontIndex);//2:<3A><><EFBFBD><EFBFBD>
|
||||
if (nengniangquObj_L.activeSelf)
|
||||
{
|
||||
nengniangquObj_L.SetActive(false);
|
||||
//<2F><><EFBFBD>ֵ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>
|
||||
GlobalEventMgr.Dispatch(GameEvent.EventShowCatchFont, true, _handType, _fontIndex);//1<><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nengniangquObj_R.activeSelf)
|
||||
{
|
||||
nengniangquObj_R.SetActive(false);
|
||||
//<2F><><EFBFBD>ֵ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>
|
||||
GlobalEventMgr.Dispatch(GameEvent.EventShowCatchFont, true, _handType, _fontIndex);//2:<3A><><EFBFBD><EFBFBD>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void GameDataManage_EventHideCatchFont()
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using BigSpace.Logic;
|
||||
using BigSpace.XRCore.Event;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@@ -25,14 +27,14 @@ public class GrabItem : MonoBehaviour
|
||||
float runTime = 0;
|
||||
|
||||
//<2F><>ʱ<EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>ֵĶ<D6B5><C4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7>
|
||||
bool isRun2 = false;
|
||||
bool isRun2 = false;
|
||||
float waitTime2 = 1f;
|
||||
float runTime2 = 0;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
m_rig = GetComponent<Rigidbody>();
|
||||
if(effectHideAndShowCtr == null)
|
||||
if (effectHideAndShowCtr == null)
|
||||
effectHideAndShowCtr = GetComponent<EffectHideAndShowCtr>();
|
||||
m_originParent = transform.parent;
|
||||
startPosition = this.transform.localPosition;
|
||||
@@ -43,7 +45,7 @@ public class GrabItem : MonoBehaviour
|
||||
{
|
||||
if (isRun)
|
||||
{
|
||||
|
||||
|
||||
runTime += Time.deltaTime;
|
||||
if (runTime >= waitTime)
|
||||
{
|
||||
@@ -108,11 +110,14 @@ public class GrabItem : MonoBehaviour
|
||||
{
|
||||
if (other.gameObject.CompareTag("RightHand"))
|
||||
{
|
||||
SceneMgr.Instance.isTrigger = true;
|
||||
//Debug.Log("Ent<6E><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:"+other.gameObject.name);
|
||||
//if (m_catch == null)
|
||||
m_catch = other.GetComponent<CatchManager>();
|
||||
m_catch = other.GetComponent<CatchManager>();
|
||||
SetTriggerParameter("DisTrigger");
|
||||
// GlobalEventMgr.Dispatch(GameEvent.EventRayEnd2);
|
||||
if (m_catch == null) return;
|
||||
// Debug.Log("111<31>Ƿ<EFBFBD><C7B7><EFBFBD>ʼ:"+ m_catch.Start);
|
||||
// Debug.Log("111<31>Ƿ<EFBFBD><C7B7><EFBFBD>ʼ:"+ m_catch.Start);
|
||||
if (m_catch.Start)
|
||||
{
|
||||
isRun = false;
|
||||
@@ -127,6 +132,15 @@ public class GrabItem : MonoBehaviour
|
||||
}
|
||||
}
|
||||
}
|
||||
private void OnTriggerExit(Collider other)
|
||||
{
|
||||
if (other.gameObject.CompareTag("RightHand"))
|
||||
{
|
||||
SceneMgr.Instance.isTrigger = false;
|
||||
//GlobalEventMgr.Dispatch(GameEvent.EventRayEnd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void OnTriggerStay(Collider other)
|
||||
{
|
||||
@@ -134,8 +148,7 @@ public class GrabItem : MonoBehaviour
|
||||
{
|
||||
//Debug.Log("Stay<61><79><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"+ other.gameObject.name);
|
||||
//if (m_catch == null)
|
||||
m_catch = other.GetComponent<CatchManager>();
|
||||
SetTriggerParameter("DisTrigger");
|
||||
m_catch = other.GetComponent<CatchManager>();
|
||||
if (m_catch == null) return;
|
||||
//Debug.Log("222<32>Ƿ<EFBFBD><C7B7><EFBFBD>ʼ:" + m_catch.Start);
|
||||
if (m_catch.Start)
|
||||
@@ -162,7 +175,7 @@ public class GrabItem : MonoBehaviour
|
||||
|
||||
private void SetStartPosition()
|
||||
{
|
||||
this.transform.localRotation = new Quaternion(0,0,0,0);
|
||||
this.transform.localRotation = new Quaternion(0, 0, 0, 0);
|
||||
this.transform.localPosition = startPosition;
|
||||
}
|
||||
|
||||
@@ -170,7 +183,7 @@ public class GrabItem : MonoBehaviour
|
||||
{
|
||||
if (this.GetComponent<UpDownMovement>() != null)
|
||||
{
|
||||
Debug.Log("<22><><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD>:"+isMove);
|
||||
Debug.Log("<22><><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD>:" + isMove);
|
||||
this.GetComponent<UpDownMovement>().isMove = isMove;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,8 @@ namespace BigSpace.Logic
|
||||
EventAnimalSend = 19, //创建动物发送
|
||||
EventAnimalSync = 20, //创建动物同步
|
||||
EventRayStart = 21, //调用射线
|
||||
EventRayEnd=33,
|
||||
EventRayEnd2 = 34,
|
||||
EventSetPAFreame = 22, //出界时设置显示区域框
|
||||
EventHideLevelPlay = 23, //隐藏出界地图
|
||||
EventSetHandMove = 24, //设置手柄是否可移动
|
||||
|
||||
@@ -10,7 +10,7 @@ public class RayCtr : MonoBehaviour
|
||||
public bool starRay = false; //<2F>Ƿ<EFBFBD><C7B7><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
|
||||
public LayerMask detectionLayer ; //<2F><><EFBFBD><EFBFBD><EFBFBD>IJ㼶
|
||||
public int myhandType; //<2F>Լ<EFBFBD><D4BC>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD> 2<><32><EFBFBD><EFBFBD>
|
||||
|
||||
public bool isstarRay = false;
|
||||
|
||||
|
||||
//<2F><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
|
||||
@@ -29,7 +29,8 @@ public class RayCtr : MonoBehaviour
|
||||
void Start()
|
||||
{
|
||||
GlobalEventMgr.Listen<int>(GameEvent.EventRayStart, GameDataManage_EventRayStart);
|
||||
|
||||
GlobalEventMgr.Listen<int>(GameEvent.EventRayEnd, GameDataManage_EventRayEnd);
|
||||
GlobalEventMgr.Listen<int>(GameEvent.EventRayEnd, GameDataManage_EventRayEnd2);
|
||||
//// <20><><EFBFBD><EFBFBD>LineRenderer<65><72><EFBFBD><EFBFBD>
|
||||
//lineRenderer = gameObject.AddComponent<LineRenderer>();
|
||||
|
||||
@@ -68,32 +69,36 @@ public class RayCtr : MonoBehaviour
|
||||
void Update()
|
||||
{
|
||||
//UpdateVisualRay(); //<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
||||
|
||||
if (!isstarRay) { return; }
|
||||
// <20>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߣ<EFBFBD><DFA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5>ԣ<EFBFBD>
|
||||
if (starRay)
|
||||
if (!SceneMgr.Instance.isTrigger)
|
||||
{
|
||||
Debug.DrawRay(transform.position, transform.forward * rayLength, Color.red);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
Ray ray = new Ray(transform.position, transform.forward);
|
||||
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 (starRay)
|
||||
{
|
||||
GameObject hitObject = hit.collider.gameObject; // <20><>ȡ<EFBFBD><C8A1>ײ<EFBFBD><D7B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
Debug.DrawRay(transform.position, transform.forward * rayLength, Color.red);
|
||||
|
||||
//Debug.Log("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: " + hitObject.name+"||"+ hitObject.name.Substring(0, 4)); // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if ("Quad" == hitObject.name.Substring(0, 4))
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
Ray ray = new Ray(transform.position, transform.forward);
|
||||
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))
|
||||
{
|
||||
fontIndex = int.Parse(hitObject.name.Substring(4));
|
||||
Debug.Log("<22><><EFBFBD>˵ڼ<CBB5><DABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>......"+ fontIndex);
|
||||
starRay = false;
|
||||
isRun = false;
|
||||
runTime = 0;
|
||||
GlobalEventMgr.Dispatch(GameEvent.EventRayQuadOk, true, myhandType, fontIndex);
|
||||
GameObject hitObject = hit.collider.gameObject; // <20><>ȡ<EFBFBD><C8A1>ײ<EFBFBD><D7B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
//Debug.Log("<22><><EFBFBD><EFBFBD><E2B5BD><EFBFBD><EFBFBD>: " + hitObject.name+"||"+ hitObject.name.Substring(0, 4)); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
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);
|
||||
starRay = false;
|
||||
isRun = false;
|
||||
runTime = 0;
|
||||
GlobalEventMgr.Dispatch(GameEvent.EventRayQuadOk, true, myhandType, fontIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isRun)
|
||||
{
|
||||
@@ -117,4 +122,12 @@ public class RayCtr : MonoBehaviour
|
||||
runTime = 0;
|
||||
}
|
||||
}
|
||||
void GameDataManage_EventRayEnd(int type)
|
||||
{
|
||||
isstarRay = true;
|
||||
}
|
||||
void GameDataManage_EventRayEnd2(int type)
|
||||
{
|
||||
isstarRay = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public class TouchPlayAnimatior : MonoBehaviour
|
||||
public AudioClip[] audioClips;
|
||||
//<2F><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
|
||||
bool isRun = false;
|
||||
float waitTime = 2f;
|
||||
float waitTime = 4f;
|
||||
float runTime = 0;
|
||||
|
||||
float showGrabItem = 1.5f; //<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>ͭ<EFBFBD>ߵ<EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
|
||||
@@ -14,6 +14,7 @@ public class SceneMgr : MonoSingleton<SceneMgr>
|
||||
private string _sceneName;
|
||||
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;
|
||||
/// <summary>
|
||||
/// <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user