Files
proto_racer/Assets/Scripts/FovAccelerator.cs
T
krazzei 2b70c884ba Kinda lost the iteration aspect of this and just finished this prototype
up. So iteration 2 technically.
Cleaned up some CarLogic code, did todos notably the brake force.
Added the concept of wheels being on or off road and hampering
acceleration if off road.
Decided to do some camera work to get a better feel for
acceleration/speed.
Implemented Lap Timers, sections, and validation upon finishing a lap.
2021-02-19 13:29:23 -06:00

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());
}
}