SmartBowController.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. namespace WildAttack
  6. {
  7. public class SmartBowController : MonoBehaviour
  8. {
  9. public static SmartBowController Instance;
  10. void Start()
  11. {
  12. Instance = this;
  13. SimulateMouseController.ins?.RemoveOpenLocker("NotGame");
  14. CameraToLook.ins.onParseRotation += OnRotationUpdate;
  15. StartCoroutine(SetOutBoundChecker());
  16. }
  17. IEnumerator SetOutBoundChecker()
  18. {
  19. yield return null;
  20. CrossHairOutBoundChecker1 outBoundChecker = Instantiate(Resources.Load<GameObject>("Prefabs/CrossHairOutBoundChecker1")).GetComponent<CrossHairOutBoundChecker1>();
  21. outBoundChecker.FetchOutBoundIndex = () => GameMananger.GetInstance().outBoundIndex;
  22. }
  23. void OnDestroy()
  24. {
  25. if (Instance == this) Instance = null;
  26. }
  27. public void OnRotationUpdate(Quaternion rotation)
  28. {
  29. if (SB_EventSystem.ins.simulateMouseIsAwaked) return;
  30. GameMananger.GetInstance().OnRotationUpdate(rotation);
  31. }
  32. public void OnShooting(float speed)
  33. {
  34. if (Time.time == 0) return;
  35. GameMananger.GetInstance().OnModuleShooting(speed);
  36. }
  37. public bool IsBluetoothModuleInited()
  38. {
  39. return BluetoothAim.ins && BluetoothAim.ins.status == BluetoothStatusEnum.ConnectSuccess;
  40. }
  41. }
  42. }