示例#1
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;
    }
示例#2
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> ();
 }
示例#3
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);
        }
示例#4
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>();
 }
 protected override void StyleRenderer(VRTK_BezierPointerRenderer renderer)
 {
     if (renderer != null)
     {
         ResetRenderer(renderer);
         renderer.gameObject.SetActive(false);
         renderer.customTracer = lineRendererPrefab;
         renderer.gameObject.SetActive(true);
     }
 }
示例#6
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>();
 }
        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;
            }
        }
 protected virtual void ResetRenderer(VRTK_BezierPointerRenderer renderer)
 {
     if (renderer != null)
     {
         renderer.gameObject.SetActive(false);
         renderer.validCollisionColor   = Color.green;
         renderer.invalidCollisionColor = Color.red;
         renderer.customTracer          = null;
         renderer.customCursor          = null;
         renderer.validLocationObject   = null;
         renderer.invalidLocationObject = null;
         renderer.rescaleTracer         = false;
         renderer.gameObject.SetActive(true);
     }
 }
示例#9
0
 protected override void StyleRenderer(VRTK_BezierPointerRenderer renderer)
 {
     if (renderer != null)
     {
         ResetRenderer(renderer);
         renderer.gameObject.SetActive(false);
         renderer.rescaleTracer         = true;
         renderer.validCollisionColor   = validLocationColor;
         renderer.invalidCollisionColor = invalidLocationColor;
         renderer.customTracer          = tracerPrefab;
         renderer.customCursor          = cursorPrefab;
         renderer.validLocationObject   = validLocationPrefab;
         renderer.invalidLocationObject = invalidLocationPrefab;
         renderer.gameObject.SetActive(true);
     }
 }
示例#10
0
        private bool boolRightPointerEnabled;                      // Whether the right controller's pointer is enabled or disabled.


        // Awake is called on initialization, BEFORE Start.
        void Awake()
        {
            LeftPointer          = LeftController.GetComponent <VRTK_Pointer>();
            LeftPointerRenderer  = LeftController.GetComponent <VRTK_BezierPointerRenderer>();
            RightPointer         = RightController.GetComponent <VRTK_Pointer>();
            RightPointerRenderer = RightController.GetComponent <VRTK_StraightPointerRenderer>();
            RightUIPointer       = RightController.GetComponent <VRTK_UIPointer>();

            LeftPointerRenderer.enabled  = false;
            LeftPointer.enabled          = false;
            RightUIPointer.enabled       = false;
            RightPointerRenderer.enabled = false;
            RightPointer.enabled         = false;

            LeftUI.SetActive(false);
            RightUI.SetActive(false);
        }
示例#11
0
    void OnEnable()
    {
        try {
            leftctrl = VRTK_DeviceFinder.GetControllerLeftHand();
        } catch (Exception e) {
            Debug.Log(e);
        }

        if (leftctrl == null)
        {
            leftctrl = GameObject.FindGameObjectWithTag("LeftController");
        }


        pointer   = leftctrl.GetComponent <VRTK_Pointer>();
        uiPointer = leftctrl.GetComponent <VRTK_UIPointer>();
        bezeierPointerRenderer  = leftctrl.GetComponent <VRTK_BezierPointerRenderer>();
        straightPointerRenderer = leftctrl.GetComponent <VRTK_StraightPointerRenderer>();
        //straightPointerRenderer = leftctrl.GetComponent<Custom_VRTK_UIStraightPointerRenderer>();
        controllerEvents = leftctrl.GetComponent <VRTK_ControllerEvents>();
    }
 protected override void StyleRenderer(VRTK_BezierPointerRenderer renderer)
 {
     cont = txt.GetComponent <QuizController>();
     cont.changeScore(correct);
 }
示例#13
0
 protected override void StyleRenderer(VRTK_BezierPointerRenderer renderer)
 {
     ResetRenderer(renderer);
 }
 protected abstract void StyleRenderer(VRTK_BezierPointerRenderer renderer);