// Update is called once per frame private void FixedUpdate() { this.transform.position = Vector3.Lerp( transform.position, new Vector3(targetPlayer.transform.position.x, targetPlayer.transform.position.y, transform.position.z), CAMERA_SPEED * Time.deltaTime ); float groundAngle = GroundTiltController.GetEulerAngleZ(); float cameraZAngle = 0; float cameraTiltFactor = AppData.GetCurrentTiltType() == AppData.GroundTiltType.Touch ? 0.3f : 0.9f; if (groundAngle <= 180f) { cameraZAngle = groundAngle * cameraTiltFactor; } else { cameraZAngle = (-360f + groundAngle) * cameraTiltFactor; } this.transform.rotation = Quaternion.Euler( 0f, 0f, cameraZAngle ); }
private void FixedUpdate() { if (jumpRegistered) { if (Time.time - lastJumpTime > DELAY_BETWEEN_JUMPS) { float groundAngle = GroundTiltController.GetEulerAngleZ(); jumpForce.x = groundAngle <= 180f ? groundAngle * -4 : (360f - groundAngle) * 4f; jellySprite.AddForce(jumpForce); lastJumpTime = Time.time; } jumpRegistered = false; } }