Scripting for driving simulator.

I am currently trying to create a driving simulator. Basically you drive a truck around a course while your gas is constantly depleting. Every time you pass through a gate your fuel refills. I am trying to just get some basic scripting down so that when you pass through the gates you also receive points. Now the question is, should I create a new script for the gates? Sorry if this is kind of vague. Any help would be greatly appreciated though, and if more information is needed just ask.

It’s better to make the interactive object detect the player rather than making the player detect objects.
Why ? Because you can give a separate script to every object. A gate, A key, A bomb, everything has its own script and the project stays manageable.

This is the function currently tied to the Truck to refill gas as you pass through the gate. The DriveCycles variable is what is controlling how full the gas gauge is as you drive.

function OnTriggerEnter(hitWhat : Collider){
//print(hitWhat.gameObject.name);
//if(hitWhat.gameObject.tag == “Gates”){

intDriveCycles = 0;
//}

}

Now I am having a hard time figuring out a way to create a new script to assign to the gates. Each gate consists of two columns and semi-transparent gate in the center. The gate shape itself is tagged “Gates” so it can be called from a script. I just don’t know where to start for the script and how to assign the points. Again any help is appreciated.