//Handle the Down event
        protected virtual void HandleDown()
        {
            inventorySpt = GetComponent<VRInteractiveItem>().inventoryScript;
            selectionRadial = GetComponent<VRInteractiveItem>().radial;
            // User must press A to interact with the object, negates the case of user holding A previous to interaction
            if (Input.GetButtonDown("aButton") && inventorySpt.retrieveObjectFromInventory(inventorySpt.activeItem).name.Contains(gateItemName))
            {
                holding = true;
                selectionRadial.enabled = true;
                Debug.Log("Show down state");
                //m_Renderer.material = m_DownMaterial;
            }
            if (holding)
            {
                selectionRadial.fillAmount = timer / holdTime;
                timer += Time.deltaTime;
                if (timer >= holdTime || holdTime == 0)
                {
                    selectionRadial.enabled = false;
                    holdSuccess();
                }
            }

            //START HERE FOR RADIAL FADING
            if (!holding) {
                selectionRadial.fillAmount = 0;
                selectionRadial.enabled = false;
                timer = 0;
            }
        }
 //Handle the Click event
 protected virtual void HandleClick()
 {
     inventorySpt = GetComponent<VRInteractiveItem>().inventoryScript;
     Debug.Log(inventorySpt.retrieveObjectFromInventory(inventorySpt.activeItem).name);
     if (Input.GetButtonDown("aButton") && inventorySpt.retrieveObjectFromInventory(inventorySpt.activeItem).name.Contains(gateItemName)) {
         clickSuccess();
     }
 }
 // Use this for initialization
 void Start()
 {
     if (SceneManager.GetActiveScene().name != "net_SpookyGarage") {
         this.enabled = false;
         return;
     }
     animator = transform.FindChild("TooltipImage").GetComponent<Animator>();
     currentText = GetComponentInChildren<Text>();
     StartCoroutine(setToolTip("controls_flashlight", "Press to Toggle Flashlight", 3f, spt_playerControls.rightThumbstickButtonPressed));
     //StartCoroutine(setToolTip(aButton, "To Interact", 13f, spt_playerControls.aButtonPressed));
     inventorySpt = transform.parent.transform.GetComponentInParent<spt_inventory>();
     endPoint = transform.parent.transform.FindChild("InspectPoint").gameObject;
 }
Пример #4
0
 public void RetrieveInventoryScript(GameObject raycastingPlayer)
 {
     inventoryScript = raycastingPlayer.GetComponent<spt_inventory>();
     radial = raycastingPlayer.GetComponentsInChildren<Image>()[0];
 }