You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
432 B
C#
23 lines
432 B
C#
using UnityEngine;
|
|
|
|
public class CameraController : MonoBehaviour
|
|
{
|
|
public Camera cam;
|
|
public float targetFOV = 30f;
|
|
public float zoomSpeed = 2f;
|
|
private bool zooming = false;
|
|
|
|
public void StartZoom()
|
|
{
|
|
zooming = true;
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
if (zooming)
|
|
{
|
|
cam.fieldOfView = Mathf.Lerp(cam.fieldOfView, targetFOV, Time.deltaTime * zoomSpeed);
|
|
}
|
|
}
|
|
}
|