28 lines
590 B
C#
28 lines
590 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Assertions;
|
|
using UnityEngine.UI;
|
|
|
|
[RequireComponent(typeof(Camera))]
|
|
public class FovAccelerator : MonoBehaviour
|
|
{
|
|
public float minFov;
|
|
public float maxFov;
|
|
public CarLogic car;
|
|
|
|
private Camera _camera;
|
|
|
|
private void Start()
|
|
{
|
|
Assert.IsTrue(car != null);
|
|
|
|
_camera = GetComponent<Camera>();
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
_camera.orthographicSize = Mathf.Lerp(minFov, maxFov, car.CurrentAccelerationRatio());
|
|
}
|
|
}
|