using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; /* 检测器-检测游戏射击准心是否出屏幕边界 */ public class CrossHairOutBoundChecker : MonoBehaviour { [SerializeField] GameObject outTip; string[] tips = null; int tipIndex = -1; void Start() { tips = new string[]{ TextAutoLanguage2.GetTextByKey("game_crosshair_outbound_0"), TextAutoLanguage2.GetTextByKey("game_crosshair_outbound_1"), TextAutoLanguage2.GetTextByKey("game_crosshair_outbound_2"), TextAutoLanguage2.GetTextByKey("game_crosshair_outbound_3"), }; if (BluetoothAim.ins && (BluetoothAim.ins.isMainConnectToInfraredDevice() || BluetoothAim.ins.isMainConnectToGun())) { //当使用HOUYI Pro和枪这种红外定位方案的连接时,需在游戏中,将“瞄准方向已超出视野范围,请将弓往左移动”这种提示语去掉 gameObject.SetActive(false); } } void Update() { int newTipIndex = -1; if (BowCamera.ins && BowCamera.ins.bowCameraFixed != null) { newTipIndex = BowCamera.ins.bowCameraFixed.outBoundIndex; } if (newTipIndex != tipIndex) { tipIndex = newTipIndex; if (tipIndex >= 0) { outTip.GetComponent().text = tips[tipIndex]; } } if (newTipIndex >= 0) { if (!outTip.activeSelf) outTip.SetActive(true); } else { if (outTip.activeSelf) outTip.SetActive(false); } } }