void Update() { // Interaction with NPC's (hard coded key for now) characterInteraction.TryInteraction = Input.GetKeyDown(KeyCode.E); if (!enablePlayerInput) { return; } // Shooting if (Input.GetButtonDown("Fire1")) { if (projectile) { Shoot(); } } // Horizontal & vertical movement rayMovement.CharacterInput = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical")); // Jumping (hard coded key for now) rayMovement.Jump = Input.GetKeyDown(KeyCode.Space); // GetKey() enables bunny hopping // Running (hard coded key for now) rayMovement.Run = Input.GetKey(KeyCode.LeftShift); // If running, sets camera's x offset if (rayMovement.Run) { cameras.SetRunXOffset((int)rayMovement.CharacterInput.x); } // If run is pressed down, activates run camera if (Input.GetKeyDown(KeyCode.LeftShift)) { cameras.ActivateRunCamera(true); } // If run button is released, deactivates run camera and x offset if (Input.GetKeyUp(KeyCode.LeftShift)) { cameras.ActivateRunCamera(false); cameras.offsetX = 0; } // Trigger activation (hard coded key for now) if (Input.GetKeyDown(KeyCode.F) && inTrigger != null) { if (inTrigger.GetComponent <DoorTrigger>() && inTrigger.GetComponent <DoorTrigger>().smoothTransition) { enablePlayerInput = false; //StartCoroutine(rayMovement.WalkToPreviousLevel(inTrigger, 2)); //StartCoroutine(SmoothLevelTransition()); inTrigger.GetComponent <Trigger>().Activate(); } if (inTrigger.GetComponent <ElevatorTrigger>()) { inTrigger.GetComponent <ElevatorTrigger>().requirementMet = transform.name.Contains(inTrigger.GetComponent <ElevatorTrigger>().requiredAuthorization) ? true : false; } inTrigger.GetComponent <Trigger>().Activate(); } if (Input.GetKeyDown(KeyCode.Tab)) { CharacterManager.ChangeCurrentCharacter(); } // Up (climb, go up in levels) (hard coded key for now) if (Input.GetKey(KeyCode.W)) { //StartCoroutine(rayMovement.GoToHigherGroundLevel()); //rayMovement.MoveToHigherGroundLevel(); } // Down (go down in levels) (hard coded key for now) if (Input.GetKey(KeyCode.S)) { //StartCoroutine(rayMovement.GoToLowerGroundLevel()); //rayMovement.MoveToLowerGroundLevel(); } }