private void Update() { if (TriggerButtonAction.GetState(pose.inputSource)) { Debug.Log("Trigger down " + pose.inputSource); //provjeravamo da li imamo objekt u rukama if (currentInteractableObject != null) { currentInteractableObject.Action(true); //pozivamo akciju na objektu return; //izlazimo iz updatea } PickupObject(); } if (TriggerButtonAction.GetStateUp(pose.inputSource)) { //pozvati action i prosljediti mu state up if (currentInteractableObject != null) { currentInteractableObject.Action(false); } } if (GrabAction.GetStateDown(pose.inputSource)) { Debug.Log(pose.inputSource + " Drop"); DropObject(); } }
// Update is called once per frame private void Update() { CalculateMovement(); // If grab button is pressed if (m_GrabAction.GetStateDown(m_Pose.inputSource)) { if (m_CurrentInteractable != null) { Drop(); return; } Pickup(); } /* * if (m_GrabAction.GetStateUp(m_Pose.inputSource)) { * print(m_Pose.inputSource + " Grab Up"); * Drop(); * }*/ if (m_UseAction.GetStateDown(m_Pose.inputSource)) { print(m_Pose.inputSource + " Use Down"); if (m_CurrentInteractable != null) { m_CurrentInteractable.Action(); } } }
void Interact() { int x = Screen.width / 2; int y = Screen.height / 2; Ray ray = camera.ScreenPointToRay(new Vector3(x, y)); RaycastHit hit; if (Physics.Raycast(ray, out hit, distance)) { Debug.Log(hit.collider); Interactable a = hit.collider.GetComponent <Interactable>(); if (a != null) { a.Action(); } NoteInteractable b = hit.collider.GetComponent <NoteInteractable>(); if (b != null) { ReadNote(b.ReceiveNote()); gameObject.GetComponentInChildren <SanityMeter1>().IncreaseSanity(-2.5f); } GameObject p = hit.collider.gameObject; if (p.CompareTag("Pill")) { p.SetActive(false); gameObject.GetComponentInChildren <SanityMeter1>().IncreaseSanity(25.0f); } } }
private void Update() { // Pickup and Drop Object code // Trigger Down if (triggerAction.GetStateDown(trackedObj.inputSource)) { #if DEBUG_Pickup Debug.Log(trackedObj.inputSource + " trigger down."); #endif if (currentInteractable != null) { currentInteractable.Action(); return; } PickUp(); } // Touchpad Down if (touchpadAction.GetStateDown(trackedObj.inputSource)) { #if DEBUG_Pickup Debug.Log(trackedObj.inputSource + " touchpad down."); #endif Drop(); } }
// Update is called once per frame void Update() { //Trigger presionado if (m_triggerAction.GetStateDown(m_pose.inputSource)) { print(m_pose.inputSource + "Trigger presionado."); //Ejecutamos accion del interactable si es que lo tenemos if (m_currentInteractable) { m_currentInteractable.Action(); //Salimos del update return; } //recojemos objeto PickUp(); } // //Triger soltado // if(m_triggerAction.GetStateUp(m_pose.inputSource)){ // print(m_pose.inputSource + "Trigger soltado."); // Drop(); // } if (m_touchPadAction.GetStateDown(m_pose.inputSource)) { print(m_pose.inputSource + "Touchpad down."); Drop(); } }
private void Update() { #region Interaction if (CanInteract && _canInteract && !interactPrompt.enabled) { interactPrompt.enabled = true; if (_interactable) { _interactable.highlight.SetActive(true); } } if (!CanInteract && interactPrompt.enabled) { interactPrompt.enabled = false; if (_interactable) { _interactable.highlight.SetActive(false); } } if (Input.GetButtonDown("Interact") && CanInteract && _canInteract && _interactable) { Input.ResetInputAxes(); interactPrompt.enabled = false; _canInteract = false; _interactable.Action(gameObject); } #endregion }
void Update() { if (Input.GetButtonDown("Fire1")) { if (Selected && player) { Selected.Action(player); } } }
private void Update() { //pointer function if (isteleporting) { m_Pointer.SetActive(m_HasPosition); m_HasPosition = UpdatePointer(); } //pinch Down if (m_pinchAction.GetStateDown(m_Pose.inputSource)) { //print(m_Pose.inputSource + "Trigger Down"); if (m_CurrentInteractable != null) { m_CurrentInteractable.Action(); return; } Pickup(); } if (m_pinchAction.GetStateUp(m_Pose.inputSource)) { Drop(); } if (m_touchpadAction.GetStateUp(m_Pose.inputSource) && isteleporting) { TryTeleport(); } //pinch Up //grip Down if (m_gripAction.GetStateDown(m_Pose.inputSource)) { //print(m_Pose.inputSource + "grip dwon"); showup(); } //grip Up if (m_gripAction.GetStateUp(m_Pose.inputSource)) { //print(m_Pose.inputSource + "dismiss"); dismiss(); } //keyboard input if (Input.GetButtonDown("Fire3")) { ChangeQuestionText(); } }
void Update() { //Trigger if (m_Trigger_Action.GetStateDown(m_Pose.inputSource)) { print(m_Pose.inputSource + "Trigger Down"); if (m_CurrentInteractable != null) //Si ya tenemos un interactuable cogido, hacemos su accion(y no lo volvemos a recoger) { m_CurrentInteractable.Action(); return; } PickUp(); } //Touchpad if (m_TouchpadAction.GetStateDown(m_Pose.inputSource)) { print(m_Pose.inputSource + "Touchpad Down"); Drop(); } //Per agafar objectes de la forma basica /* * //Down * if (m_GrabAction.GetStateDown(m_Pose.inputSource)) * { * print(m_Pose.inputSource + "Trigger Down"); * PickUp(); * } * * //Up * * if (m_GrabAction.GetStateUp(m_Pose.inputSource)) * { * print(m_Pose.inputSource + "Trigger UP"); * Drop(); * } */ }
// Update is called once per frame private void Update() { // Do object action if (currentInteractable != null && touchpadAction.GetStateDown(pose.inputSource)) { currentInteractable.Action(); return; } // Grab object if in range if (grabAction.GetStateDown(pose.inputSource))// && grabTimer == 0.0f) { Pickup(); canDrop = false; StartCoroutine(DropTimere()); } // Drop object if (grabAction.GetStateDown(pose.inputSource) && player.grabStyle && currentInteractable && canDrop) { Drop(); StartCoroutine(handColliderRestorer()); } if (grabAction.GetStateUp(pose.inputSource) && !player.grabStyle && currentInteractable) { Drop(); StartCoroutine(handColliderRestorer()); } /* * // Drop object * if (grabAction.GetStateUp(pose.inputSource))//&& grabTimer == 0.0f) * { * //grabTimer = maxGrabTimer; * Drop(); * StartCoroutine(handColliderRestorer()); * } * * // Reduce timer * if(grabTimer != 0.0f) * { * grabTimer -= Time.deltaTime; * } */ }
// Update is called once per frame void Update() { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, rayLength)) { Interactable interactable = hit.transform.GetComponent <Interactable>(); if (interactable != null) { if (Input.GetMouseButtonDown(0)) { interactable.Action(); } } } }
void Update() { if (m_TriggerAction.GetStateDown(m_Pose.inputSource)) { print(m_Pose.inputSource + "Trigger Down"); if (m_CurrentInteractable != null) { m_CurrentInteractable.Action(); return; } Pickup(); } if (m_TouchpadAction.GetStateDown(m_Pose.inputSource)) { print(m_Pose.inputSource + "Touchpad Up"); Drop(); } }