Beispiel #1
0
        private void Awake()
        {
            thisGrabbable = GetComponent <VR_Grabbable>();
            player        = GameObject.FindGameObjectWithTag("Player").transform;

            if (stringController == null)
            {
                stringController = transform.GetComponentInChildren <BowStringController>();
            }

            bowStringController.Grabbable.OnGrabStateChange.AddListener(OnStringGrabStateChange);
            thisGrabbable.OnGrabStateChange.AddListener(OnThisGrabStateChange);

            leftController  = VR_Manager.instance.LeftController;
            rightController = VR_Manager.instance.RightController;

            //try to get the grabzone
            if (arrowGrabZone == null && bowControlMode == BowControlMode.Realistic)
            {
                arrowGrabZone = FindArrowGrabbableZone();

                if (arrowGrabZone == null)
                {
                    Debug.LogError("Realistic bow needs a arrow grabzone in order to work!");
                }
            }

            if (arrowGrabZone != null)
            {
                arrowGrabZone.enabled = false;
            }
        }
Beispiel #2
0
        private void OnEnable()
        {
            interactDistance   = serializedObject.FindProperty("interactDistance");
            interactButton     = serializedObject.FindProperty("interactButton");
            usePerHandSettings = serializedObject.FindProperty("usePerHandSettings");
            rightHandSettings  = serializedObject.FindProperty("rightHandSettings");
            leftHandSettings   = serializedObject.FindProperty("leftHandSettings");
            handSettings       = serializedObject.FindProperty("handSettings");
            grabbable          = serializedObject.FindProperty("grabbable");

            targetScript = (VR_GrabbableZone)target;
        }