Data Implementer

//Make sure you put data handler in the Standard Assets folder. In case of errors, fixes can be found in the comments of the video. Check out the pinned comment for most probable fix.

#pragma strict

var carSelected : int;
var trackSelected : int;
var trackCoordinate : Vector3[];

var r8 : GameObject;
var f458 : GameObject;
var skyline : GameObject;
var car : Transform;

function Start () {

carSelected = GameObject.Find("DataHandler").GetComponent(DataHandler).carSel;
 trackSelected = GameObject.Find("DataHandler").GetComponent(DataHandler).trackSel;
 
 if (carSelected == 1) {
 r8.SetActive (true);
 f458.SetActive (false);
 skyline.SetActive (false);
 }
 
 else if (carSelected == 2) {
 
 r8.SetActive (false);
 f458.SetActive (true);
 skyline.SetActive (false);
 }
 
 else if (carSelected == 3) {
 
 r8.SetActive (false);
 f458.SetActive (false);
 skyline.SetActive (true);
 }
 
 car.position = trackCoordinate[trackSelected-1];
}

function Update () {

}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s