I am working on a Truck Driving game project for a Class and there is a gate that is supposed to refuel the truck however the thing is i need to know what im missing to make this work
function OnTriggerExit(hitWhat : Collider){
if(hitWhat.gameObject.name == "gate") {
var myVariable : GameObject = GameObject.Find("PreCap");
var myChildVariable : GameObject = myVariable.Find("Parent_Cap");
myChildVariable.animation.Play("CapAnime");
Destroy(hitWhat.gameObject);
}
else if(hitWhat.gameObject.name == "gateE"){;
Application.LoadLevel ("Truck_GameOver");
}
else if(hitWhat.gameObject.name == "gateF"){;
var fuel = 100;
}
}
any suggestions would be appreacated
there is a var fuel : fuel float; far above in the script the full thing was to long to slap in but thank you that helps alot
– ShinzonIf already there's a fuel variable, just remove the keyword var before fuel = 100;. The keyword var declares a temporary variable, which hides any other instance previously declared.
– aldonaletto