private void Update() { if (!initialized || !gamePlayer.hasAuthority) { return; } if (health.IsDead) { playerCamera.transform.position = transform.position + observerOffset; playerCamera.transform.rotation = Quaternion.LookRotation(transform.position - playerCamera.transform.position); return; } SetAttributes(); RaycastHit hit; if (Physics.Raycast(playerCamera.transform.position, playerCamera.transform.forward, out hit)) { this.lookPoint = hit.point; } else { this.lookPoint = playerCamera.transform.position + playerCamera.transform.forward * 1000f; } bool isRunning = Input.GetKey(KeyCode.LeftShift); Vector3 currSpeed = new Vector3(Input.GetAxis("Horizontal"), 0f, Input.GetAxis("Vertical")); currSpeed = canMove ? (isRunning ? currSpeed * moveSpeed.CurrentValue * runModifier : currSpeed * moveSpeed.CurrentValue) : Vector3.zero; float moveDirectionY = moveDirection.y; moveDirection = transform.forward * currSpeed.z + transform.right * currSpeed.x; if (Input.GetButton("Jump") && controller.isGrounded) { animator.SetTrigger("isJumping"); moveDirection.y = jumpSpeed.CurrentValue; } else { moveDirection.y = moveDirectionY; } if (!controller.isGrounded) { moveDirection.y -= gravity * Time.deltaTime; } if (deck && !deck.IsAnchored) { currSpeed = currSpeed.normalized; if (!isRunning) { currSpeed /= 2; } animator.SetFloat("velx", currSpeed.x); animator.SetFloat("vely", currSpeed.z); controller.Move(moveDirection * Time.deltaTime); } if (canMove) { rotationX += -Input.GetAxis("Mouse Y") * lookSpeed; rotationX = Mathf.Clamp(rotationX, -lookXLimit, lookXLimit); playerCamera.transform.localRotation = Quaternion.Euler(rotationX, 0, 0); playerCamera.transform.localPosition = cameraLocation.transform.localPosition; transform.rotation *= Quaternion.Euler(0, Input.GetAxis("Mouse X") * lookSpeed, 0); } didCast = false; cast.Evaluate(); if (cast.Down) { Cast(); } if (cast.Held) { deck.Hold(); } if (cast.Released) { deck.Release(); } cancel.Evaluate(); if (cancel.Down) { CancelSpell(); } if (Input.GetKeyDown(KeyCode.Alpha1)) { SelectSpell(0); } if (Input.GetKeyDown(KeyCode.Alpha2)) { SelectSpell(1); } if (Input.GetKeyDown(KeyCode.Alpha3)) { SelectSpell(2); } if (Input.GetKeyDown(KeyCode.Alpha4)) { SelectSpell(3); } if (Input.GetKeyDown(KeyCode.Alpha5)) { SelectSpell(4); } if (didCast) { // animator.SetTrigger("isCasting"); } if (Input.GetKeyDown(KeyCode.R)) { deck.StartShuffle(); } }