| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- namespace WildAttack
- {
- public class SmartBowController : MonoBehaviour
- {
- public static SmartBowController Instance;
- void Start()
- {
- Instance = this;
- SimulateMouseController.ins?.RemoveOpenLocker("NotGame");
- //if (InfraredDemo.running)
- //{
- // InfraredDemo.infraredCameraHelper.OnPositionUpdate += OnScreenPointUpdate;
- //}
- //else CameraToLook.ins.onParseRotation += OnRotationUpdate;
- if (AimHandler.ins.bRuning9Axis())
- {
- CameraToLook.ins.onParseRotation += OnRotationUpdate;
- }
- else
- {
- InfraredDemo.infraredCameraHelper.OnPositionUpdate += OnScreenPointUpdate;
- }
- StartCoroutine(SetOutBoundChecker());
- }
- IEnumerator SetOutBoundChecker()
- {
- yield return null;
- CrossHairOutBoundChecker1 outBoundChecker = Instantiate(Resources.Load<GameObject>("Prefabs/CrossHairOutBoundChecker1")).GetComponent<CrossHairOutBoundChecker1>();
- outBoundChecker.FetchOutBoundIndex = () => GameMananger.GetInstance().outBoundIndex;
- }
- void OnDestroy()
- {
- if (Instance == this) Instance = null;
- //if (InfraredDemo.running)
- //{
- // InfraredDemo.infraredCameraHelper.OnPositionUpdate -= OnScreenPointUpdate;
- //}
- if (AimHandler.ins.bRuning9Axis())
- {
- CameraToLook.ins.onParseRotation -= OnRotationUpdate;
- }
- else
- {
- InfraredDemo.infraredCameraHelper.OnPositionUpdate -= OnScreenPointUpdate;
- }
- }
- public void OnRotationUpdate(Quaternion rotation)
- {
- if (SB_EventSystem.ins.simulateMouseIsAwaked) return;
- GameMananger.GetInstance().OnRotationUpdate(rotation);
- }
- public void OnScreenPointUpdate(Vector2 point)
- {
- if (SB_EventSystem.ins.simulateMouseIsAwaked) return;
- GameMananger.GetInstance().OnScreenPointUpdate(point);
- }
- float _lastShootTime = 0;
- public void OnShooting(float speed)
- {
- if (Time.time == 0) return;
- if (Time.realtimeSinceStartup - _lastShootTime < 1) return;
- _lastShootTime = Time.realtimeSinceStartup;
- GameMananger.GetInstance().OnModuleShooting(speed);
- }
- public bool IsBluetoothModuleInited()
- {
- return BluetoothAim.ins && BluetoothAim.ins.status == BluetoothStatusEnum.ConnectSuccess;
- }
- }
- }
|