Car Selector

//The car selector script used in tutorial. The script has been updated.

using UnityEngine;
using System.Collections;

public class CarSelector : MonoBehaviour {
 public GameObject r8;
 public GameObject f458;
 public GameObject sls;
 public int carSelected;
 //Activating only the first car and disabling the rest.
 void Start () {
 
 r8.SetActive (true);
 f458.SetActive (false);
 sls.SetActive (false);
 carSelected = 1;
 }
//Functions that are called by the buttons when clicked.
 
 public void loadR8 () {
 r8.SetActive (true);
 f458.SetActive (false);
 sls.SetActive (false);
 carSelected = 1;
 }
 public void load458 () {
 r8.SetActive (false);
 f458.SetActive (true);
 sls.SetActive (false);
 
 carSelected = 2;
 }
 public void loadSLS () {
 r8.SetActive (false);
 f458.SetActive (false);
 sls.SetActive (true);
 
 carSelected = 3;
 }
}
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