|
|
@@ -6,6 +6,7 @@ using UnityEngine.UI;
|
|
|
using DG.Tweening;
|
|
|
using SmartBowSDK;
|
|
|
using System.Collections;
|
|
|
+using UnityEngine.SceneManagement;
|
|
|
|
|
|
/* 蓝牙瞄准模块 */
|
|
|
/* 管理1p和2p蓝牙连接,脚本外调用逻辑如果同时连接1p和2p设备,以前的逻辑还是以1p为主,如果只连2p,则使用2p数据*/
|
|
|
@@ -780,7 +781,8 @@ public class BluetoothAim : MonoBehaviour
|
|
|
public void onCreateSmartBowHelper2P() {
|
|
|
|
|
|
smartBowHelper2P = SmartBowHelper.NewInstance();
|
|
|
-
|
|
|
+ smartBowHelper2P.SetFilters("Bbow_20210501 | HOUYI Pro | Pistol | Pistol M9 | ARTEMIS Pro");
|
|
|
+
|
|
|
smartBowHelper2P.OnBluetoothModuleInited += () =>
|
|
|
{
|
|
|
Debug.Log("OnBluetoothModuleInited");
|
|
|
@@ -856,7 +858,7 @@ public class BluetoothAim : MonoBehaviour
|
|
|
smartBowHelper2P.OnFunctionKeyPress += () =>
|
|
|
{
|
|
|
//如果是双人场景,触发提示
|
|
|
- if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "GameDouble")
|
|
|
+ if (SceneManager.GetActiveScene().name == "GameDouble")
|
|
|
{
|
|
|
if (GameObject.Find("AutoResetViewNewRight")) return;
|
|
|
GameObject resetView = Instantiate(Resources.Load<GameObject>("AutoResetViewNew"));
|
|
|
@@ -868,7 +870,25 @@ public class BluetoothAim : MonoBehaviour
|
|
|
smartBowHelper2P.ResetAim();
|
|
|
};
|
|
|
}
|
|
|
- else {
|
|
|
+ else if (SceneManager.GetActiveScene().name == "InfraredGameDouble") {
|
|
|
+ if (GameObject.Find("AutoResetViewNewRight")) return;
|
|
|
+ GameObject resetView = Instantiate(Resources.Load<GameObject>("AutoResetViewNew"));
|
|
|
+ resetView.name = "AutoResetViewNewRight";
|
|
|
+ AutoResetViewNew autoResetViewNewScript = resetView.GetComponent<AutoResetViewNew>();
|
|
|
+ autoResetViewNewScript.setTextKey("new-user-guider_tip_视角归位-瞄准-infraredD");
|
|
|
+ autoResetViewNewScript.setPosRight();
|
|
|
+ autoResetViewNewScript.action_OnDestroy += () =>
|
|
|
+ {
|
|
|
+ if (SceneManager.GetActiveScene().name == "InfraredGameDouble")
|
|
|
+ {
|
|
|
+ //InfraredDemo._ins?.SetAdjustPointsOffset(PlayerType.SecondPlayer);
|
|
|
+ //右边校准大点
|
|
|
+ InfraredDemo._ins?.SetAdjustPointsOffset(PlayerType.FirstPlayer);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
smartBowHelper2P.ResetAim();
|
|
|
}
|
|
|
|
|
|
@@ -1027,14 +1047,17 @@ public class BluetoothAim : MonoBehaviour
|
|
|
}
|
|
|
//更新跟随点位置
|
|
|
public void UpdateCameraToLookNewPoint2P() {
|
|
|
- if (CameraToLookNew.ins != null)
|
|
|
- {
|
|
|
- Transform m_controlObj = CameraToLookNew.ins.transform;
|
|
|
- if (lerpForRotation2P)
|
|
|
- m_controlObj.localRotation = Quaternion.Lerp(m_controlObj.localRotation, newRotation2P, Time.deltaTime * lerpTimeRate2P);
|
|
|
- else
|
|
|
- m_controlObj.localRotation = newRotation2P;
|
|
|
+ if (SceneManager.GetActiveScene().name != "InfraredGameDouble") {
|
|
|
+ if (CameraToLookNew.ins != null)
|
|
|
+ {
|
|
|
+ Transform m_controlObj = CameraToLookNew.ins.transform;
|
|
|
+ if (lerpForRotation2P)
|
|
|
+ m_controlObj.localRotation = Quaternion.Lerp(m_controlObj.localRotation, newRotation2P, Time.deltaTime * lerpTimeRate2P);
|
|
|
+ else
|
|
|
+ m_controlObj.localRotation = newRotation2P;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public int get2PBattery() {
|