protected override void OnPlayingEnable() { base.OnPlayingEnable(); _mousePosition = _target.GetType().GetField("_mousePosition", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(_target) as MousePosition; _mouseRotation = _target.GetType().GetField("_mouseRotation", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(_target) as MouseRotation; _positionLimitCenter = new Vector3((_mousePosition.XMaxLimit - _mousePosition.XMinLimit) / 2 + _mousePosition.XMinLimit , (_mousePosition.YMaxLimit - _mousePosition.YMinLimit) / 2 + _mousePosition.YMinLimit , (_mousePosition.ZMaxLimit - _mousePosition.ZMinLimit) / 2 + _mousePosition.ZMinLimit); _positionLimitSize = new Vector3(_mousePosition.XMaxLimit - _mousePosition.XMinLimit , _mousePosition.YMaxLimit - _mousePosition.YMinLimit , _mousePosition.ZMaxLimit - _mousePosition.ZMinLimit); }
protected override void OnRuntimeEnable() { base.OnRuntimeEnable(); _mousePosition = Target.GetType().GetField("_mousePosition", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(Target) as MousePosition; _mouseRotation = Target.GetType().GetField("_mouseRotation", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(Target) as MouseRotation; _positionLimitCenter.Set((_mousePosition.XMaxLimit - _mousePosition.XMinLimit) / 2 + _mousePosition.XMinLimit , (_mousePosition.YMaxLimit - _mousePosition.YMinLimit) / 2 + _mousePosition.YMinLimit , (_mousePosition.ZMaxLimit - _mousePosition.ZMinLimit) / 2 + _mousePosition.ZMinLimit); _positionLimitSize.Set(_mousePosition.XMaxLimit - _mousePosition.XMinLimit , _mousePosition.YMaxLimit - _mousePosition.YMinLimit , _mousePosition.ZMaxLimit - _mousePosition.ZMinLimit); _limitMin.Set(_mousePosition.XMinLimit, _mousePosition.YMinLimit, _mousePosition.ZMinLimit); _limitMax.Set(_mousePosition.XMaxLimit, _mousePosition.YMaxLimit, _mousePosition.ZMaxLimit); }
/// <summary> /// 初始化 /// </summary> /// <param name="rayAction">射线击中事件</param> public void OnInitialization(HTFAction <MouseRayTargetBase, Vector3, Vector2> rayAction) { _module = Module as ControllerManager; MainCamera = _module.transform.GetComponentByChild <Camera>("MainCamera"); _cameraTarget = _module.transform.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; _mouseRotation.Target = _cameraTarget; _mouseRay.RayCamera = MainCamera; _mouseRay.RayEvent += rayAction; }
public override void Initialization() { base.Initialization(); MainCamera = transform.GetComponentByChild <Camera>("MainCamera"); _cameraTarget = transform.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; _mouseRotation.Target = _cameraTarget; _mouseRay.RayCamera = MainCamera; }
/// <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); }; }
public override void OnInitialization() { base.OnInitialization(); DOTween.defaultEaseType = DefaultEase; DOTween.defaultAutoPlay = DefaultAutoPlay; DOTween.defaultAutoKill = IsAutoKill; MainCamera = transform.GetComponentByChild <Camera>("MainCamera"); _cameraTarget = transform.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; _mouseRotation.Target = _cameraTarget; _mouseRay.RayCamera = MainCamera; _mouseRay.RayEvent += OnRay; }
protected override void OnEnable() { _mousePosition = target as MousePosition; }
private void OnEnable() { _mousePosition = target as MousePosition; }