コード例 #1
0
        private void Awake()
        {
            if (FindObjectOfType <VR_Manager>() == null)
            {
                Debug.LogError("you need a VR_Manager active in the scene in order to use VR Shooter Kit");
            }

            Setup();

#if SDK_STEAM_VR
            SteamVR_Behaviour_Pose controller = transform.GetComponentInParent <SteamVR_Behaviour_Pose>();
            controller.onConnectedChanged.AddListener(delegate(SteamVR_Behaviour_Pose poseController, SteamVR_Input_Sources sources, bool state) { OnControlllerConnectedChangeEvent(state); });
#endif

            gestureScript = GetComponent <VR_ControllerGesture>();
            thisCollider  = GetComponent <Collider>();
            rb            = GetComponent <Rigidbody>();
            Input         = new VR_Input(this);


            if (animator != null)
            {
                CreateOverrideAnimator();
                SetupAnimatiorHashes();
            }

            SaveLocalPositionAndRotation();
            originalParent = transform.parent;

            originalParentRB = originalParent.GetComponent <Rigidbody>();
        }
コード例 #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="controllerType"></param>
        /// <param name="grabbableList"></param>
        public void Construct(List <VR_Interactable> interactList, List <VR_Highlight> highlightList, ControllerGestureConfig config)
        {
            //set controller type and get a refenrece to the grabbableList
            this.interactList  = interactList;
            this.highlightList = highlightList;

            VR_ControllerGesture controllerGesture = GetComponent <VR_ControllerGesture>();

            if (controllerGesture != null)
            {
                controllerGesture.Construct(config);
            }
        }