Please assume the role of a unity developer specialising in unity 2020.2.6f1 and visual studio 2017.
I wish to share some scripts with you. The first is a hoverboard controller a hoverboard is like a skateboard but it hovers.
Script 1:
using UnityEngine;
using UnityEngine.UI;

[RequireComponent(typeof(Rigidbody))]
public class HoverBoardControl : MonoBehaviour
{
private float boardslideSoundTime;
private bool boardSlideCheck;
private bool noseSlideCheck;
private bool tailSlideCheck;

public bool IsSteeringLeft { get { return isSteeringLeft; } }
public bool IsSteeringRight { get { return isSteeringRight; } }

[Header(“Hover Settings”)]
public float hoverForce = 1500f;
public float hoverHeight = 6f;
public GameObject[] hoverPoints;

[Header(“Movement Settings”)]
public float forwardAcceleration = 100.0f;
public float backwardAcceleration = 25.0f;
[SerializeField] private float turnStrength = 10f; // Made it serializable for editor control

[Header(“UI & Scoring”)]
public Text scoreText;
public int currentScore;
public HUD hud;
public TrickManager trickManager;

[Header(“Boost Settings”)]
public float boostMultiplier = 2.0f;

[Header(“Rotation Settings”)]
public float minRotation = -20.0f;
public float maxRotation = 0.0f;

[Header(“Timer Settings”)]
public float timer = 5.0f;

[Header(“Miscellaneous”)]
public bool moving;
public GameObject board;

[Header(“Input Settings”)]
public KeyCode moveForwardKey = KeyCode.W;
public KeyCode moveBackwardKey = KeyCode.S;
public KeyCode turnLeftKey = KeyCode.A;
public KeyCode turnRightKey = KeyCode.D;

[Header(“Customizable Keys”)]
[SerializeField] private KeyCode ollieKey = KeyCode.Space;
[SerializeField] private KeyCode boostKey = KeyCode.LeftControl;

int layerMask;
float currentThrust;
float currentTurn;

Rigidbody rb;

private GrindDetection grindDetection; // Reference to the GrindDetection script
public bool IsGrounded { get; set; }
public AudioSource GrindAudio { get; set; }
public Vector3 BoardTilt { get; set; }
private bool isSteeringLeft;
private bool isSteeringRight;

void Awake()
{
rb = GetComponent<Rigidbody>();
hud = FindObjectOfType<HUD>();
trickManager = GetComponent<TrickManager>();
grindDetection = GetComponentInChildren<GrindDetection>();
GrindAudio = GetComponent<AudioSource>();
isSteeringLeft = false;
isSteeringRight = false;
}

// Add the following methods to match GrindDetection expectations
public void GrindAudioVolumeLerp(float targetVolume, float lerpSpeed)
{
GrindAudio.volume = Mathf.Lerp(GrindAudio.volume, targetVolume, lerpSpeed * Time.deltaTime);
}

public void RotateAround(Vector3 point, Vector3 axis, float angle)
{
rb.transform.RotateAround(point, axis, angle * Time.deltaTime);
}

public void Rotate(Vector3 axis, float angle, Space relativeTo)
{
rb.transform.Rotate(axis * angle * Time.deltaTime, relativeTo);
}

public void TransformLocalRotationLerp(Quaternion targetRotation, float lerpSpeed)
{
rb.transform.localRotation = Quaternion.Lerp(rb.transform.localRotation, targetRotation, lerpSpeed * Time.deltaTime);
}

public void TransformRotationLerp(Quaternion targetRotation, float lerpSpeed)
{
rb.transform.rotation = Quaternion.Lerp(rb.transform.rotation, targetRotation, lerpSpeed * Time.deltaTime);
}

// Add the following method to start the grind
public void StartGrind()
{
grindDetection.StartGrind();
}

void Start()
{
layerMask = 1 << LayerMask.NameToLayer(“Characters”);
layerMask = ~layerMask;

if (scoreText == null)
{
GameObject canvas = GameObject.Find(“Canvas”);
if (canvas != null)
{
scoreText = Instantiate(Resources.Load(“ScoreText”, typeof(Text))) as Text;
scoreText.transform.SetParent(canvas.transform, false);
}
else
{
Debug.LogError(“Canvas not found. Make sure there is a Canvas GameObject in the scene.”);
}
}
}

void OnEnable()
{
rb.isKinematic = false;
rb.useGravity = true;
}

void OnDisable()
{
rb.velocity = Vector3.zero;
rb.angularVelocity = Vector3.zero;
rb.isKinematic = true;
}

void GetSteeringInput()
{
isSteeringLeft = Input.GetKey(turnLeftKey);
isSteeringRight = Input.GetKey(turnRightKey);
}

void Update()
{
GetSteeringInput();

currentThrust = 0.0f;

// Adjust currentTurn directly based on input
if (isSteeringLeft)
{
currentTurn = -turnStrength;
}
else if (isSteeringRight)
{
currentTurn = turnStrength;
}
else
{
currentTurn = 0.0f;
}

// Allow adjustment of currentThrust from the Unity GUI inspector
currentTurn = Mathf.Clamp(currentTurn, -1.0f, 1.0f); // Clamp the value between -1 and 1

scoreText.text = currentScore + " Points";

if (Input.GetKeyDown(ollieKey))
{
trickManager.ExecuteOllieOrTrick(1500f);
}

if (hud != null)
{
if (Input.GetKeyDown(boostKey) && (hud.BoostInt > 0))
{
forwardAcceleration = forwardAcceleration * boostMultiplier;
backwardAcceleration = backwardAcceleration * boostMultiplier;

if (hud.BoostInt <= 0)
{
forwardAcceleration = forwardAcceleration / boostMultiplier;
backwardAcceleration = backwardAcceleration / boostMultiplier;
}
}

if (Input.GetKey(boostKey))
{
hud.BoostInt -= 0.2f;
}
}

Vector3 currentRotation = transform.rotation.eulerAngles;
currentRotation.x = Mathf.Clamp(currentRotation.x, minRotation, maxRotation);
currentRotation.z = Mathf.Clamp(currentRotation.z, minRotation, maxRotation);
transform.rotation = Quaternion.Euler(currentRotation);

float aclAxis = Input.GetAxis(“Vertical”);
if (aclAxis > 0.1f)
currentThrust = aclAxis * forwardAcceleration;
else if (aclAxis < -0.1f)
currentThrust = aclAxis * backwardAcceleration;

// Remove the following block of code related to currentTurn
// if (Mathf.Abs(currentTurn) > 0.1f)
// {
// if (isSteeringLeft)
// currentTurn = -turnStrength;
// else if (isSteeringRight)
// currentTurn = turnStrength;
// }

// currentTurn = Mathf.Clamp(currentTurn, -1.0f, 1.0f); // Remove this line

// Check for grinding input
if (Input.GetKeyDown(grindDetection.GrindKey))
{
StartGrind();
}
}

void FixedUpdate()
{
ApplyHover();
ApplyMovement();
ApplyTurning();
ApplyGrinding();
}

void ApplyHover()
{
for (int i = 0; i < hoverPoints.Length; i++)
{
var hoverPoint = hoverPoints[i];
RaycastHit hoverHit;
if (Physics.Raycast(hoverPoint.transform.position, -Vector3.up, out hoverHit, hoverHeight, layerMask))
{
rb.AddForceAtPosition(Vector3.up * hoverForce * (1.0f - (hoverHit.distance / hoverHeight)), hoverPoint.transform.position);
}
else
{
if (transform.position.y > hoverPoint.transform.position.y)
{
rb.AddForceAtPosition(hoverPoint.transform.up * hoverForce, hoverPoint.transform.position);
}
else
{
rb.AddForceAtPosition(hoverPoint.transform.up * -hoverForce, hoverPoint.transform.position);
}
}
}
}

void ApplyMovement()
{
if (Mathf.Abs(currentThrust) > 0)
{
rb.AddForce(transform.forward * currentThrust);
}
}

void ApplyTurning()
{
if (currentTurn != 0)
{
rb.AddRelativeTorque(Vector3.up * currentTurn * turnStrength);
}
}

void ApplyGrinding()
{
if (grindDetection.IsGrinding())
{
// Apply grinding logic here
// Access grindDetection properties and methods as needed

// Example: Reduce hover height and force during grinding


// Add your custom logic here based on the skateboard script

if (boardSlideCheck || noseSlideCheck || tailSlideCheck)
{
boardslideSoundTime += Time.deltaTime;
if (boardslideSoundTime > 0f && boardslideSoundTime < 0.1f && !GrindAudio.isPlaying)
{
GrindAudio.Play(); // Assuming GrindAudio is your AudioSource
}
}
else
{
boardslideSoundTime = 0f;
GrindAudio.Stop(); // Assuming GrindAudio is your AudioSource
}

// Add the rest of your custom logic from the skateboard script
// Adjust rotations, movements, and other parameters as needed
}
else
{
// Reset hover height and force when not grinding


// Add the rest of your logic for when not grinding
// Reset any adjustments made during grinding, if necessary
}
}
}

Please wait before responding I have more scripts I wish to share with you.