I'm doing a car shop system in the Unity engine, and I need a method to activate a contour type on the selected car. However, I need the contour of the other cars to automatically turn off. The script I already have is this:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class CarShop : MonoBehaviour {
public string carroSelected;
public Text velMaxima;
public Text Acele;
public Text cambio;
public Text Motor;
public GameObject capContorno;
public GameObject copContorno;
public GameObject viaContorno;
public GameObject nviaContorno;
// Use this for initialization
void Start () {
velMaxima.text = "0 km/H";
Acele.text = "0s";
cambio.text = "0 Marchas";
Motor.text = "NULL";
}
// Update is called once per frame
void Update () {
}
public void capitalSel () {
carroSelected = "Capital";
velMaxima.text = "110 km/h";
Acele.text = "21.90s";
cambio.text = "4 Marchas";
Motor.text = "Boxxer";
capContorno.SetActive(true);
copContorno.SetActive(false);
viaContorno.SetActive(false);
nviaContorno.SetActive(false);
}
public void copaSel () {
carroSelected = "Copa";
velMaxima.text = "170 km/h";
Acele.text = "10.3s";
cambio.text = "5 Marchas";
Motor.text = "AP (Alta Performance)";
capContorno.SetActive(true);
copContorno.SetActive(false);
viaContorno.SetActive(false);
nviaContorno.SetActive(false);
}
public void viagemSel () {
carroSelected = "Viagem";
velMaxima.text = "170 km/h";
Acele.text = "11.5s";
cambio.text = "5 Marchas";
Motor.text = "AP (Alta Performance)";
capContorno.SetActive(true);
copContorno.SetActive(false);
viaContorno.SetActive(false);
nviaContorno.SetActive(false);
}
public void nViagemSel () {
carroSelected = "Novo Viagem";
velMaxima.text = "190 km/h";
Acele.text = "10s";
cambio.text = "5 Marchas";
Motor.text = "Power EA";
capContorno.SetActive(true);
copContorno.SetActive(false);
viaContorno.SetActive(false);
nviaContorno.SetActive(false);
}
}