/*When close enough to an interactable object, a text will appear prompting the player to interact with it. The interactable objects keep track of what message to display and what happens when the player interacts with them.*/ void Update() { if (Input.GetButtonDown("Interact") && currentInteractable != null && !paused && inputManager.CurrentInputMode == InputMode.Playing) { currentInteractable.Interact(this); this.currentInteractable = null; rb.velocity = Vector3.zero; StartCoroutine("NonMovingInteract"); interactText.gameObject.SetActive(false); interactText.text = ""; } } void OnTriggerEnter(Collider other) //Avgör vilken IIinteractable spelaren kan interagera med { if (other.gameObject.GetComponent() == null) return; currentInteractable = other.gameObject.GetComponent(); if (currentInteractable is ClimbableScript) { movement.ChangeJump("Climb"); } interactText.text = currentInteractable.GetText(); interactText.gameObject.SetActive(true); } void OnTriggerExit(Collider other) { IInteractable otherInteractable = other.gameObject.GetComponent(); if (otherInteractable != null && currentInteractable == otherInteractable) { if (currentInteractable is ClimbableScript) { movement.ChangeJump("Jump"); } currentInteractable = null; interactText.gameObject.SetActive(false); interactText.text = ""; } }