// Update is called once per frame private void Update() { if (canInteract) { SetCursor(cursorInteract); if (Input.GetButtonUp("Fire1")) { if (EventSystem.current.IsPointerOverGameObject()) // Make click not work on world objects if mouse over GUI { return; } interactableObject.InteractWithObject(); } else if (Input.GetButtonDown("Fire2")) { if (EventSystem.current.IsPointerOverGameObject()) { return; } tempInteractObjectReference = interactableObject; ShowContextMenu(); } } else { //SetCursor(cursorDefault); } }
public void InteractWithObject(Interaction interactionType) { switch (interactionType) { case Interaction.Inspect: print(tempInteractObjectReference.InspectObject()); break; case Interaction.Interact: tempInteractObjectReference.InteractWithObject(); break; case Interaction.PickUp: tempInteractObjectReference.PickUpObject(); break; default: Debug.Log("No case in switch statement"); break; } }