Пример #1
0
        public override void OnBeginSetting()
        {
            base.OnBeginSetting();

            GameObject controllerManager = GameObject.Find("HTFramework/Controller");

            if (controllerManager)
            {
                _controllerManager = controllerManager.GetComponent <ControllerManager>();
            }
        }
Пример #2
0
        /// <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;
        }
        /// <summary>
        /// 初始化助手
        /// </summary>
        public void OnInitialization()
        {
            _module             = Module as ControllerManager;
            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.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);
            };
        }
Пример #4
0
        protected override void OnEnable()
        {
            _target = target as ControllerManager;

            base.OnEnable();
        }
 public override void OnEnable()
 {
     _target = Target as ControllerManager;
 }