private void Update() { if (InputSplitter.GetInteractPressed(fpsMove.PlayerID)) { RaycastHit hitInfo; if (Physics.Raycast(cameraTransform.position, cameraTransform.forward, out hitInfo, InteractDistance, interactLayer)) { if (hitInfo.collider.gameObject.layer == airconLayer) { GameObject hitObj = hitInfo.transform.parent.gameObject; Aircon airconController = hitObj.GetComponent <Aircon>(); if (airconController) { airconController.Activate(); } } else if (hitInfo.collider.gameObject.layer == doorLayer) { GameObject hitObj = hitInfo.transform.parent.parent.gameObject; Door doorController = hitObj.GetComponent <Door>(); if (doorController) { doorController.Activate(); } } else if (hitInfo.collider.gameObject.layer == elevatorActivateLayer) { GameObject hitObj = hitInfo.transform.parent.gameObject; Elevator elevatorController = hitObj.GetComponent <Elevator>(); if (elevatorController) { elevatorController.Activate(); } } else if (hitInfo.collider.gameObject.layer == elevatorSlowActivateLayer) { Elevator elevatorController = elevatorTerminal.GetComponent <Elevator>(); if (elevatorController) { elevatorController.ActivateSlow(); } } } } if (InputSplitter.GetSmokePressed(fpsMove.PlayerID)) { smokeBombController.Activate(); } }