internal void Awake() { firstPersonMovement = GetComponent <FirstPersonMovement>(); defaultRunSpeed = firstPersonMovement.DefaultRunSpeed; slowSpeed = defaultRunSpeed / AirconSlowFactor; isEnabled = false; calledSlow = false; calledSlowEnabled = false; painPlayed = false; aircon = Aircon.GetComponent <Aircon>(); }
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(); } }