void CastRay() { RaycastHit hit; if (Physics.Raycast(camera.transform.position, camera.transform.forward, out hit, 2.4f, 1, QueryTriggerInteraction.Collide)) { Item item = hit.collider.GetComponent <Item> (); ShipWheel shipWheel = hit.collider.GetComponent <ShipWheel> (); Harbourmaster harbourmaster = hit.collider.GetComponent <Harbourmaster> (); if (item) { uiManager.SetInteractTextToItem(item); if (Input.GetKeyDown(KeyCode.E)) { AttemptPickUpItem(item); } } else if (shipWheel) { uiManager.SetInteractText("E - Take control"); if (Input.GetKeyDown(KeyCode.E)) { shipManager.ActivateShipWheel(shipWheel.GetComponentInParent <Ship>()); } } else if (harbourmaster) { uiManager.SetInteractText("E - Access port"); if (Input.GetKeyDown(KeyCode.E)) { uiManager.EnablePortMenu(harbourmaster.GetPort()); } } else { uiManager.ClearInteractText(); } } else { uiManager.ClearInteractText(); } }