using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.SceneManagement; public class buttonController : MonoBehaviour { // Reference to the button public GameObject btnLeftArrow, btnRightArrow; /*GameObject btnColor1, btnColor2, btnColor3, btnColor4, btnColor5, btnDecal1, btnDecal2, btnDecal3, btnDecal4, btnDecal5, btnWheel1, btnWheel2, btnWheel3;*/ GameObject[] bodyXC90, bodyS90, bodyV40; GameObject[] wheelXC90, wheelS90, wheelV40; // Reference to the video GameObject tinter, videoBS, videoF, videoB, popup; GameObject btnVidBS, btnVidF, btnVidB; GameObject btnCheckBS, btnCheckF, btnCheckB; GameObject nextSceneBtn; public Sprite[] checkSafety; public Sprite checkBtn; //bool checkBS, checkF, checkB; //public static bool watchAll; // Reference to the canvas GameObject interiorCanvas; public Sprite seatBlack, seatCream, seatSilver, dashBlack, dashSilver; // Reference to the background sprite public Sprite[] bgCar; public GameObject bgCanvasObj; //public Sprite S90, XC90, V40; int currentIndexCanvasObj; // Reference to the sprite for interior done button public Sprite[] doneInteriorBtn; GameObject miniDash, descDash, miniSeat, descSeat; // Reference to the sprite for paint body done button public Sprite[] donePaintBtn; GameObject miniPaint, descPaint, miniDecal, descDecal, miniWheel, descWheel; // Reference to the material public Material[] S90Decal, V40Decal, XC90Decal; public Material[] S90Paint, V40Paint, XC90Paint; public static Material matS90, matV40, matXC90; Material[] matsS90; Material[] matsV40_1, matsV40_2, matsV40_3, matsV40_6, matsV40_8, matsV40_9, matsV40_11, matsV40; Material[] matsXC90_1, matsXC90_2; // Reference text print path GameObject pathTxt; // Use this for initialization void Start () { //Debug.Log("the current: " + bgCanvasObj.GetComponent().sprite + "; index: " + currentIndexCanvasObj + "; bgCar: " + bgCar[currentIndexCanvasObj]); Scene scene = SceneManager.GetActiveScene(); if (scene.name == "selection") {matS90 = S90Paint[0];} if (scene.name == "paintCar") { miniPaint = GameObject.Find("paint mini Btn"); descPaint = GameObject.Find("paint desc Btn"); miniDecal = GameObject.Find("decal mini Btn"); descDecal = GameObject.Find("decal desc Btn"); miniWheel = GameObject.Find("wheel mini Btn"); descWheel = GameObject.Find("wheel desc Btn"); if (bodyXC90 == null) {bodyXC90 = GameObject.FindGameObjectsWithTag("bodyXC90");} if (bodyS90 == null) {bodyS90 = GameObject.FindGameObjectsWithTag("bodyS90");} if (bodyV40 == null) {bodyV40 = GameObject.FindGameObjectsWithTag("bodyV40");} if (wheelXC90 == null) {wheelXC90 = GameObject.FindGameObjectsWithTag("wheelXC90");} if (wheelS90 == null) {wheelS90 = GameObject.FindGameObjectsWithTag("wheelS90");} if (wheelV40 == null) {wheelV40 = GameObject.FindGameObjectsWithTag("wheelV40");} /*btnColor1 = GameObject.Find("bodyColor1 Btn"); btnColor2 = GameObject.Find("bodyColor2 Btn"); btnColor3 = GameObject.Find("bodyColor3 Btn"); btnColor4 = GameObject.Find("bodyColor4 Btn"); btnColor5 = GameObject.Find("bodyColor5 Btn"); btnDecal1 = GameObject.Find("decalColor1 Btn"); btnDecal2 = GameObject.Find("decalColor2 Btn"); btnDecal3 = GameObject.Find("decalColor3 Btn"); btnDecal4 = GameObject.Find("decalColor4 Btn"); btnDecal5 = GameObject.Find("decalColor5 Btn"); btnWheel1 = GameObject.Find("wheelColor1 Btn"); btnWheel2 = GameObject.Find("wheelColor2 Btn"); btnWheel3 = GameObject.Find("wheelColor3 Btn");*/ } if (scene.name == "interiorDesign") { interiorCanvas = GameObject.Find("interior Img"); interiorCanvas.SetActive(false); miniSeat = GameObject.Find("seat mini Btn"); descSeat = GameObject.Find("seat desc Btn"); miniDash = GameObject.Find("dash mini Btn"); descDash = GameObject.Find("dash desc Btn"); } if (scene.name == "customizeSafety") { tinter = GameObject.Find("Tint"); videoBS = GameObject.Find("BS Video"); videoF = GameObject.Find("F Video"); videoB = GameObject.Find("B Video"); popup = GameObject.Find("popup"); btnCheckBS = GameObject.Find("WatchedBS Btn"); btnCheckF = GameObject.Find("WatchedF Btn"); btnCheckB = GameObject.Find("WatchedB Btn"); //tinter.gameObject.SetActive(false); videoBS.gameObject.SetActive(false); videoF.gameObject.SetActive(false); videoB.gameObject.SetActive(false); btnVidBS = GameObject.Find("blind spot Btn"); btnVidF = GameObject.Find("front Btn"); btnVidB = GameObject.Find("back Btn"); nextSceneBtn = GameObject.Find("NextScene Btn"); nextSceneBtn.GetComponent