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