void InitVar()
 {
     m_pointer        = GetComponent <VRTK_Pointer>();
     m_playAreaCursor = GetComponent <VRTK_PlayAreaCursor>();
     m_interTouch     = GetComponent <VRTK_InteractTouch>();
     m_interGrab      = GetComponent <VRTK_InteractGrab>();
 }
Esempio n. 2
0
    private void Start()
    {
        radialMenu = GetComponentInChildren <VRTK_RadialMenu>();
        if (!radialMenu)
        {
            Debug.Log("This ControllerSceneMenu object doesn't have a radial menu attached!");
            return;
        }

        foreach (var button in radialMenu.buttons)
        {
            button.OnClick.AddListener(Hide);
        }

        var controllerEvents = GetComponentInParent <VRTK_ControllerEvents>();

        pointer = GetComponentInParent <VRTK_Pointer>();

        if (controllerEvents)
        {
            controllerEvents.ButtonTwoPressed += Controller_ButtonTwoPressed;
        }

        Hide();
    }
Esempio n. 3
0
 private void Awake()
 {
     pointer = GetComponent <VRTK_Pointer>();
     pointer.DestinationMarkerEnter += Pointer_DestinationMarkerEnter;
     pointer.DestinationMarkerExit  += Pointer_DestinationMarkerExit;
     pointer.DestinationMarkerSet   += Pointer_DestinationMarkerSet;
 }
Esempio n. 4
0
    public void Start()
    {
        pointer          = GetComponent <VRTK_Pointer>();
        bezierRenderer   = GetComponent <VRTK_BezierPointerRenderer>();
        straightRenderer = GetComponent <VRTK_StraightPointerRenderer>();

        attacker  = PlayerController.GetComponent <PlayerAttacker>();
        commander = PlayerController.GetComponent <PlayerCommander>();
        digger    = PlayerController.GetComponent <PlayerDigger>();
        flyer     = PlayerController.GetComponent <PlayerFlyer>();
        grabber   = PlayerController.GetComponent <PlayerGrabber>();
        mover     = PlayerController.GetComponent <PlayerMover>();
        summoner  = PlayerController.GetComponent <PlayerSummoner>();

        mover.PointerRenderer = bezierRenderer;

        SetPointer(false);

        pointer.DestinationMarkerHover += (object marker, DestinationMarkerEventArgs args) => {
            destinationArgs = args;
            destination     = args.destinationPosition;
        };

        controllerEvents = GetComponent <VRTK_ControllerEvents>();

        controllerEvents.TriggerPressed   += OnTriggerPressed;
        controllerEvents.TriggerReleased  += OnTriggerReleased;
        controllerEvents.TouchpadPressed  += OnTouchpadPressed;
        controllerEvents.TouchpadReleased += OnTouchpadReleased;
    }
Esempio n. 5
0
 // Use this for initialization
 void Start()
 {
     vrtkControllerEvents         = GetComponent <VRTK_ControllerEvents> ();
     vrtk_Pointer                 = GetComponent <VRTK_Pointer> ();
     vrtk_StraightPointerRenderer = GetComponent <VRTK_StraightPointerRenderer> ();
     vrtk_BezierPointerRenderer   = GetComponent <VRTK_BezierPointerRenderer> ();
 }
Esempio n. 6
0
        public void Enable(IHandController ctl)
        {
            if (point != null)
            {
                GameObject.Destroy(point);
            }
            if (renderer != null)
            {
                GameObject.Destroy(renderer);
            }
            if (raycast != null)
            {
                GameObject.Destroy(raycast);
            }

            point    = ctl.gameObject.AddComponent <VRTK_Pointer>();
            renderer = ctl.gameObject.AddComponent <VRTK_StraightPointerRenderer>();
            raycast  = ctl.gameObject.AddComponent <VRTK_CustomRaycast>();

            point.pointerRenderer  = renderer;
            renderer.customRaycast = raycast;

            point.enableTeleport   = false;
            point.activationButton = VRTK_ControllerEvents.ButtonAlias.TriggerPress;
            raycast.layersToIgnore = ctl.Player.PointerIgnoreLayers;
        }
    private void Awake()
    {
        audioSource = GetComponent <AudioSource>();
        audioSource.spatialBlend = 1.0f; // 3D
        pointer = GetComponent <VRTK_Pointer>();
        pointer.SelectionButtonPressed  += OnIAOSelectionButtonPressed;
        pointer.SelectionButtonReleased += OnIAOSelectionButtonReleased;
        pointer.PointerStateValid       += OnIAOPointerStateValid;
        pointer.PointerStateInvalid     += OnIAOPointerStateInvalid;

        // another audio for looping audio
        loopingAudioSource = gameObject.AddComponent(typeof(AudioSource)) as AudioSource;
        BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Default | BindingFlags.DeclaredOnly;

        System.Reflection.PropertyInfo[] properties = typeof(AudioSource).GetProperties(flags);
        foreach (System.Reflection.PropertyInfo property in properties)
        {
            if (property.CanWrite)
            {
                try
                {
                    property.SetValue(loopingAudioSource, property.GetValue(audioSource, null), null);
                }
                catch { }
            }
        }
        System.Reflection.FieldInfo[] fields = typeof(AudioSource).GetFields(flags);
        foreach (System.Reflection.FieldInfo field in fields)
        {
            field.SetValue(loopingAudioSource, field.GetValue(audioSource));
        }

        loopingAudioSource.clip = teleportPointerLoopClip;
        loopingAudioSource.loop = true;
    }
Esempio n. 8
0
    // Use this for initialization
    void Start()
    {
        VRTK_Pointer pointer = GetComponent <VRTK_Pointer>();

        pointer.DestinationMarkerHover += DestinationMarkerHover;
        pointer.DestinationMarkerSet   += DestinationMarkerSet;
    }
 // Use this for initialization
 void OnEnable()
 {
     _Pointer = GetComponent <VRTK_Pointer>();
     _Pointer.DestinationMarkerEnter += _Pointer_DestinationMarkerEnter;
     _Pointer.DestinationMarkerExit  += _Pointer_DestinationMarkerExit;
     _Pointer.DestinationMarkerSet   += _Pointer_DestinationMarkerSet;
 }
Esempio n. 10
0
    private void Start()
    {
        controllerEvents = GetComponent <VRTK_ControllerEvents>();
        controllerEvents.TouchpadPressed     += OnTouchpadStart;
        controllerEvents.TouchpadAxisChanged += OnTouchpadAxisChange;
        controllerEvents.TouchpadReleased    += OnTouchpadEnd;
        controllerEvents.TriggerClicked      += OnTriggerStart;
        controllerEvents.TriggerUnclicked    += OnTriggerEnd;
        controllerEvents.GripClicked         += OnGripStart;
        controllerEvents.GripUnclicked       += OnGripEnd;
        controllerEvents.ButtonTwoPressed    += ControllerEvents_ButtonTwoPressed;
        controllerEvents.ButtonOnePressed    += ControllerEvents_ButtonOnePressed;

        interactGrab = GetComponent <VRTK_InteractGrab>();

        vrtkPointer = GetComponent <VRTK_Pointer>();
        vrtkPointer.DestinationMarkerEnter += VrtkPointer_DestinationMarkerEnter;
        vrtkPointer.pointerRenderer.GetPointerObjects();

        // Keep pointer on scene change
        DontDestroyOnLoad(actualCursor.transform.root.gameObject);
        DontDestroyOnLoad(actualTracer.transform.root.gameObject);

        SceneManager.sceneLoaded += InstantiatePhotonObjects;
    }
Esempio n. 11
0
        public void Enable(IHandController ctl)
        {
            if (point != null)
            {
                GameObject.Destroy(point);
            }
            if (renderer != null)
            {
                GameObject.Destroy(renderer);
            }
            if (raycast != null)
            {
                GameObject.Destroy(raycast);
            }

            point    = ctl.gameObject.AddComponent <VRTK_Pointer>();
            renderer = ctl.gameObject.AddComponent <VRTK_BezierPointerRenderer>();
            raycast  = ctl.gameObject.AddComponent <VRTK_CustomRaycast>();

            point.pointerRenderer  = renderer;
            renderer.customRaycast = raycast;

            point.enableTeleport   = true;
            point.activationButton = VRTK_ControllerEvents.ButtonAlias.TriggerPress;
            point.selectionButton  = VRTK_ControllerEvents.ButtonAlias.TriggerPress;
            point.selectOnPress    = false;
            raycast.layersToIgnore = ctl.Player.PointerIgnoreLayers;

            ctl.Player.Teleport.InitDestinationSetListener(ctl.gameObject, true);
        }
Esempio n. 12
0
    private void Awake()
    {
        pointer   = GetComponent <VRTK_Pointer>();
        uiPointer = GetComponent <VRTK_UIPointer>();

        pointer.PointerStateValid   += PointerStateValid;
        pointer.PointerStateInvalid += PointerStateInvalid;
    }
Esempio n. 13
0
 void Start()
 {
     io  = GetComponentInParent <VRTK_InteractableObject>();
     po  = GetComponent <VRTK_Pointer>();
     spr = GetComponent <VRTK_StraightPointerRenderer>();
     io.InteractableObjectGrabbed   += ObjectGrabbed;
     io.InteractableObjectUngrabbed += ObjectUngrabbed;
 }
    private void Start()
    {
        rightPointer         = ReferenceHandler.Instance.GetRightPointer();
        rightPointerRenderer = ReferenceHandler.Instance.GetRightPointerRenderer();

        rightPointer.ActivationButtonPressed  += SetPointerActivated;
        rightPointer.ActivationButtonReleased += SetPointerDeactivated;
    }
Esempio n. 15
0
 void Start()
 {
     trackedObject = gameObject.GetComponent <ZXTK_Controller>().trackedObject;
     _Pointer      = gameObject.GetComponent <VRTK_Pointer>();
     line          = gameObject.GetComponent <LineRenderer>();
     a             = false;
     Actice        = false;
 }
        void Awake()
        {
            myCamera = GetComponent <Camera>();
            pointer  = controller.GetComponent <VRTK_Pointer>();
            pointer.DestinationMarkerEnter += OnPointerEnter;

            SetMaterial();
        }
Esempio n. 17
0
 private void InitVar()
 {
     handAnimator    = handModel.GetComponent <Animator>();
     controllerEvent = GetComponent <VRTK_ControllerEvents>();
     interactTouch   = GetComponent <VRTK_InteractTouch>();
     interactGrab    = GetComponent <VRTK_InteractGrab>();
     interactUsed    = GetComponent <VRTK_InteractUse>();
     pointer         = GetComponent <VRTK_Pointer>();
 }
Esempio n. 18
0
    private void Awake()
    {
        touchTeleport = FindObjectOfType <DisableTeleportOnTouch>();
        pointer       = GetComponent <VRTK_Pointer>();
        uiPointer     = GetComponent <VRTK_UIPointer>();

        pointer.PointerStateValid   += PointerStateValid;
        pointer.PointerStateInvalid += PointerStateInvalid;
    }
Esempio n. 19
0
 private void Start()
 {
     rightPointer  = rightController.GetComponent <VRTK_Pointer>();
     leftPointer   = leftController.GetComponent <VRTK_Pointer>();
     rightBezier   = rightController.GetComponent <VRTK_BezierPointerRenderer>();
     rightStraight = rightController.GetComponent <VRTK_StraightPointerRenderer>();
     leftBezier    = leftController.GetComponent <VRTK_BezierPointerRenderer>();
     leftStraight  = leftController.GetComponent <VRTK_StraightPointerRenderer>();
 }
Esempio n. 20
0
 void Start()
 {
     rotate     = touchpadRotate.GetComponent <VRTouchpadRotate>();
     move       = leftController.GetComponent <VRTK_TouchpadControl>();
     blur       = motionBlurControl.GetComponent <MotionBlurControl>();
     pointer    = leftController.GetComponent <VRTK_Pointer>();
     bezier     = leftController.GetComponent <VRTK_BezierPointerRenderer>();
     controller = leftController.GetComponent <VRTK_ControllerEvents>();
     pScript    = portalScript.GetComponent <RedirectedPortals>();
 }
 private void Awake()
 {
     audioSource = GetComponent <AudioSource>();
     audioSource.spatialBlend = 1.0f; // 3D
     pointer = GetComponent <VRTK_Pointer>();
     pointer.ActivationButtonPressed  += OnIAOActivationButtonPressed;
     pointer.ActivationButtonReleased += OnIAOActivationButtonReleased;
     pointer.PointerStateValid        += OnIAOPointerStateValid;
     pointer.PointerStateInvalid      += OnIAOPointerStateInvalid;
 }
        void MakeItSo()
        {
            var go = Fsm.GetOwnerDefaultTarget(gameObject);

            if (go == null)
            {
                return;
            }

            if (!enablePointer.IsNone)
            {
                pointer         = go.GetComponent <VRTK_Pointer>();
                pointer.enabled = enablePointer.Value;
            }

            // set pointer renderer to be beizer
            if (enableBezierRenderer.Value)
            {
                bezier = go.GetComponent <VRTK_BezierPointerRenderer>();
                pointer.pointerRenderer = bezier;
            }

            // set pointer renderer to be straight
            if (enableStraightRenderer.Value)
            {
                straight = go.GetComponent <VRTK_StraightPointerRenderer>();
                pointer.pointerRenderer = straight;
            }

            if (!enableBezierRenderer.IsNone)
            {
                bezier         = go.GetComponent <VRTK_BezierPointerRenderer>();
                bezier.enabled = enableBezierRenderer.Value;
            }

            if (!enableHeightAdjustTele.IsNone)
            {
                heightTeleport         = go.GetComponent <VRTK_HeightAdjustTeleport>();
                heightTeleport.enabled = enableHeightAdjustTele.Value;
            }

            if (!enableStraightRenderer.IsNone)
            {
                straight         = go.GetComponent <VRTK_StraightPointerRenderer>();
                straight.enabled = enableStraightRenderer.Value;
            }

            if (!enableBodyTeleport.IsNone)
            {
                bodyPhysics = bodyPhysicsGO.Value.GetComponent <VRTK_BodyPhysics>();
                bodyPhysics.enableTeleport = enableBodyTeleport.Value;
            }
        }
Esempio n. 23
0
    public override bool StartGrab(GameObject grabbingObject, GameObject givenGrabbedObject, Rigidbody givenControllerAttachPoint)
    {
        pointer = grabbingObject.GetComponent <VRTK_Pointer>();
        //transform.ChangeLayersRecursively("Ignore Raycast");
        //pointer.pointerRenderer.layersToIgnore -= LayerMask.NameToLayer("StickTo");
        //pointer.pointerRenderer.customRaycast.layersToIgnore += LayerMask.NameToLayer("Default");

        pointer = grabbingObject.GetComponent <VRTK_Pointer>();
        //GetComponent<Collider>().enabled = false;
        offset = 0f;
        return(base.StartGrab(grabbingObject, givenGrabbedObject, givenControllerAttachPoint));
    }
Esempio n. 24
0
 void OnEnable()
 {
     fpscontrollerScript = GameObject.FindGameObjectWithTag("Player").GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
     //pixel = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren<Pixelation>();
     if (!pointer)
     {
         pointer = GameObject.Find("RightController").GetComponent <VRTK_Pointer>();
     }
     straightRenderer = GameObject.Find("RightController").GetComponent <VRTK_StraightPointerRenderer>();
     //  pointer.enabled = false;
     // straightRenderer.enabled = false;
 }
Esempio n. 25
0
        public void AssignedAllReference()
        {
            ClayMesh = null;
            ClayMesh = GameObject.FindGameObjectWithTag("Mesh");

            texpaint      = GameObject.FindGameObjectWithTag("TP").GetComponent <VRTexturePainter> ();
            MeshTransform = ClayMesh.GetComponent <GetMeshTransform> ();
            dm            = GameObject.FindGameObjectWithTag("SM").GetComponent <VRSmooth>();
            filter        = ClayMesh.GetComponent <MeshFilter> ();
            //currentTool = Tools.Sculpt;
            point = rightController.GetComponent <VRTK_Pointer>();
        }
Esempio n. 26
0
    // Use this for initialization
    void Start()
    {
        var snapEvents = GetComponent <VRTK.UnityEventHelper.VRTK_SnapDropZone_UnityEvents>();

        if (snapEvents == null)
        {
            snapEvents = gameObject.AddComponent <VRTK.UnityEventHelper.VRTK_SnapDropZone_UnityEvents>();
        }
        pointer = GetComponentInParent <VRTK_Pointer>();
        snapEvents.OnObjectSnappedToDropZone.AddListener(ObjectSnapped);
        snapEvents.OnObjectUnsnappedFromDropZone.AddListener(ObjectUnsnapped);
    }
    void InstantiateCabinet(GameObject _controller)
    {
        VRTK_Pointer[] pointers = _controller.GetComponents <VRTK_Pointer>();
        pointer = pointers[1];
        Transform hit = pointer.pointerRenderer.GetDestinationHit().transform;

        if (hit.gameObject.layer == 8)
        {
            objPlacement = Instantiate(cabinetPrefab, pointer.pointerRenderer.GetDestinationHit().point, Quaternion.identity);
            manager      = objPlacement.GetComponent <CabinetManager>();
            Debug.Log("New cabinet instantiated");
        }
    }
Esempio n. 28
0
        public override void OnEnter()
        {
            var go = Fsm.GetOwnerDefaultTarget(gameObject);

            theScript = go.GetComponent <VRTK_Pointer>();

            MakeItSo();

            if (!everyFrame.Value)
            {
                Finish();
            }
        }
Esempio n. 29
0
        public override void OnEnter()
        {
            var go = Fsm.GetOwnerDefaultTarget(gameObject);

            pointer = go.GetComponent <VRTK_Pointer>();

            checkPointer();

            if (!everyFrame.Value)
            {
                Finish();
            }
        }
Esempio n. 30
0
    // Use this for initialization
    void Start()
    {
        GameObject[] gameObjects = UnityEngine.Object.FindObjectsOfType <GameObject>();

        pointer = GetComponent <VRTK_Pointer>();

        foreach (GameObject i in gameObjects)
        {
            if (i.GetComponent <VRTK_InteractableObject>() != null)
            {
                i.GetComponent <VRTK_InteractableObject>().InteractableObjectUsed += Position_InteractableObjectUsed;
            }
        }
    }