/// <summary> /// 刷新 /// </summary> public void OnRefresh() { if (IsOpenRay) { if (GlobalTools.IsPointerOverUGUI()) { RaycastHiting(GetCurrentUGUI()); } else { _ray = RayCamera.ScreenPointToRay(Main.m_Input.MousePosition); if (Physics.Raycast(_ray, out _hit, 100, ActivatedLayer)) { HitPoint = _hit.point; RaycastHiting(_hit.transform.gameObject); } else { RaycastHiting(null); } } Vector2 pos = Main.m_Input.MousePosition.ScreenToUGUIPosition(null, RayHitImageType); RaycastHitBGFlow(pos); RayEvent?.Invoke(Target, HitPoint, pos); } }
/// <summary> /// 关闭射线投射 /// </summary> public void CloseRay() { IsOpenRay = false; RaycastHiting(null); RayEvent?.Invoke(null, Vector3.zero, Vector2.zero); if (RayHitBG && RayHitBG.gameObject.activeSelf) { RayHitBG.gameObject.SetActive(false); } }
public override void OnInitialization() { base.OnInitialization(); DOTween.defaultEaseType = DefaultEase; DOTween.defaultAutoPlay = DefaultAutoPlay; DOTween.defaultAutoKill = IsAutoKill; _helper.RayEvent += (target, point, point2D) => { RayEvent?.Invoke(target, point, point2D); }; }
/// <summary> /// 初始化助手 /// </summary> public void OnInitialization() { MainCamera = Module.GetComponentByChild <Camera>("MainCamera"); _cameraTarget = Module.GetComponentByChild <CameraTarget>("CameraTarget"); _mousePosition = MainCamera.GetComponent <MousePosition>(); _mouseRotation = MainCamera.GetComponent <MouseRotation>(); _mouseRay = MainCamera.GetComponent <MouseRay>(); _highlightingEffect = MainCamera.GetComponent <HighlightingEffect>(); _mousePosition.Target = _cameraTarget; _mousePosition.MR = _mouseRotation; _mousePosition.Manager = Module as ControllerManager; _mouseRotation.Target = _cameraTarget; _mouseRotation.Manager = Module as ControllerManager; _mouseRay.RayCamera = MainCamera; _mouseRay.RayEvent += (target, point, point2D) => { RayEvent?.Invoke(target, point, point2D); }; }
private void OnRay(MouseRayTargetBase mouseRayTargetBase, Vector3 point, Vector2 pos) { RayEvent?.Invoke(mouseRayTargetBase, point, pos); }