예제 #1
0
 private void SetDestinationMarker()
 {
     if (dm == null)
     {
         dm = GetComponent <VRTK_DestinationMarker>();
     }
 }
        // script attached to the canvas to change the description in the textbox

        /// <summary>
        /// Enable the listeners on both controller and pointer to all events
        /// </summary>
        protected virtual void OnEnable()
        {
            pointer = (pointer == null ? GetComponent <VRTK_DestinationMarker>() : pointer);
            // find the activated pointer
            if (pointer != null)
            {
                controllerEvent = pointer.GetComponent <VRTK_ControllerEvents>();
                GlobalMonitor   = Global.GetComponent <Monitor>();
                controllerEvent.TouchpadPressed += ControllerEvent_TouchpadPressed;
                // event that touchpad is pressed
                controllerEvent.GripClicked += ControllerEvent_GripClicked;
                // event that grip button is pressed
                interact = pointer.GetComponent <VRTK_InteractGrab>();
                interact.GrabButtonReleased += Interact_GrabButtonReleased;
                // event that grab button is released
                pointer.DestinationMarkerEnter += DestinationMarkerEnter;
                // event that pointer enters an object
                pointer.DestinationMarkerHover += DestinationMarkerHover;
                // event that pointer hovers on an object
                pointer.DestinationMarkerExit += DestinationMarkerExit;
                // event that pointer exits an object
                pointer.DestinationMarkerSet += DestinationMarkerSet;
                // event that the destination marker is active in the scene to determine the last destination
                instructionScript = instructionCanvas.GetComponent <Instruction>();
            }
            else
            {
                // print out the error if the pointer cannot be found
                VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "VRTKExample_PointerObjectHighlighterActivator", "VRTK_DestinationMarker", "the Controller Alias"));
            }
        }
예제 #3
0
        protected virtual void OnEnable()
        {
            pointer = (pointer == null ? GetComponent <VRTK_DestinationMarker>() : pointer);

            if (pointer != null)
            {
                pointer.DestinationMarkerSet += DestinationMarkerSet;
            }
            else
            {
                VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "VRTKExample_OptionTileSelector", "VRTK_DestinationMarker", "the Controller Alias"));
            }
        }
예제 #4
0
        //public Painting painting;


        protected virtual void OnEnable()
        {
            pointer = (pointer == null ? GetComponent <VRTK_DestinationMarker>() : pointer);
            //painting = pen.GetComponent<Painting>();
            if (pointer != null)
            {
                pointer.DestinationMarkerEnter += DestinationMarkerEnter;
                pointer.DestinationMarkerHover += DestinationMarkerHover;
                pointer.DestinationMarkerExit  += DestinationMarkerExit;
                pointer.DestinationMarkerSet   += DestinationMarkerSet;
            }
            else
            {
                VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "VRTKExample_PointerObjectHighlighterActivator", "VRTK_DestinationMarker", "the Controller Alias"));
            }
        }
 /// <summary>
 /// Observable DestinationMarkerSet event
 /// </summary>
 /// <param name="events"></param>
 /// <returns></returns>
 public static IObservable <DestinationMarkerEventArgs> DestinationMarkerSetAsObservable(this VRTK_DestinationMarker events)
 {
     return(Observable.FromEvent <DestinationMarkerEventHandler, DestinationMarkerEventArgs>(
                h => (s, e) => h(e),
                h => events.DestinationMarkerSet += h,
                h => events.DestinationMarkerSet -= h));
 }