Heya i was wondering how to implement a timer into the script i attached am not that good of a scripter so if u can point me in the right direction or help me.
by time i mean a delay before maxboost is max for an example when the car goes above 3500 rpm i want it to engage the turbo but not with max boost i want a delay on the part so it takes maybe 0.5 seconds or something like that before max boost is reached.
also if anyone knows how to attach this to a GUI later that would be awesome.
and also if anyone can help me optimize the script that would be helpful.
// Johan
using UnityEngine;
using System.Collections;
public class Turbo : MonoBehaviour {
public float minBoost;
public float maxBoost;
public float boost;
Drivetrain drive;
// Use this for initialization
void Start ()
{
drive = GetComponent<Drivetrain>();
}
// Update is called once per frame
void Update ()
{
if (drive.rpm > 3500f)
{
if (maxBoost > minBoost)
{
drive.powerMultiplier = 2f;
boost = maxBoost;
}
}
else
{
if (maxBoost > minBoost)
{
drive.powerMultiplier = 1f;
boost = minBoost;
}
}
}
}