using UnityEngine;

public class CameraMovement : MonoBehaviour
{
	public Vector2 horizontalBounds;
	public Transform playerTransform;
	public Transform cameraTransform;
	public float lerp = 0.1f;

	private void Update()
	{
		var direction = new Vector3(-17, 31.5f, Mathf.Clamp(playerTransform.position.z, horizontalBounds.x, horizontalBounds.y));
		var desiredRotation = Quaternion.LookRotation(direction - cameraTransform.position);
		cameraTransform.rotation = Quaternion.Lerp(cameraTransform.rotation, desiredRotation, lerp);
	}
}
