void SwitchTutorialState() { switch (tutorialState) { case "clean_leaves": if (GameObject.Find("TutPosStart_clean_leaves") != null) { startPos = GameObject.Find("TutPosStart_clean_leaves").transform.position; LeafBlower lb = GameObject.Find("Tools/LeafBlower").GetComponent <LeafBlower>(); if (lb.bLeaves1) { endPos = lb.psLeaves1.transform.position; } else if (lb.bLeaves2) { endPos = lb.psLeaves2.transform.position; } else if (lb.bLeaves3) { endPos = lb.psLeaves3.transform.position; } else if (lb.bLeaves4) { endPos = lb.psLeaves4.transform.position; } else if (lb.bLeaves5) { endPos = lb.psLeaves5.transform.position; } StartPointing(); StartCoroutine("MovePoinnter"); } break; case "cut_branches": if (GameObject.Find("TutPosStart_cut_branches") != null) { startPos = GameObject.Find("TutPosStart_cut_branches").transform.position; Shears sh = GameObject.Find("Tools/Shears").GetComponent <Shears>(); string[] branchNames = sh.BranchesToCut.Split(new char[] { ',' }, System.StringSplitOptions.RemoveEmptyEntries); if (branchNames.Length > 0) { int ind = Mathf.FloorToInt(Random.Range(0, branchNames.Length)); if (GameObject.Find(branchNames[ind]) != null) { endPos = GameObject.Find(branchNames[ind]).transform.position; StartPointing(); StartCoroutine("MovePoinnter"); } } } break; case "clean_dirt": if (GameObject.Find("TutPosStart_clean_dirt") != null) { startPos = GameObject.Find("TutPosStart_clean_dirt").transform.position; WaterHose wh = GameObject.Find("Tools2/WaterHose/Nozzle").GetComponent <WaterHose>(); string[] names = wh.LeftToBeCleaned.Split(new char[] { ',' }, System.StringSplitOptions.RemoveEmptyEntries); if (names.Length > 0) { int ind = Mathf.FloorToInt(Random.Range(0, names.Length)); if (GameObject.Find(names[ind]) != null) { endPos = GameObject.Find(names[ind]).transform.position; transform.position = startPos; StartPointing(); StartCoroutine("MovePoinnter"); } } } break; case "clean_stains": if (GameObject.Find("TutPosStart_clean_stains") != null) { startPos = GameObject.Find("TutPosStart_clean_stains").transform.position; WaterGun wg = GameObject.Find("Tools2/Compressor/WaterGun").GetComponent <WaterGun>(); string[] names = wg.LeftToBeCleaned.Split(new char[] { ',' }, System.StringSplitOptions.RemoveEmptyEntries); if (names.Length > 0) { int ind = Mathf.FloorToInt(Random.Range(0, names.Length)); if (GameObject.Find(names[ind]) != null) { endPos = GameObject.Find(names[ind]).transform.position + new Vector3(.5f, -.5f, 0); transform.position = startPos; StartPointing(); StartCoroutine("MovePoinnter"); } } } break; case "wheel_brush": if (GameObject.Find("TutPosStart_wheel_brush") != null) { startPos = GameObject.Find("TutPosStart_wheel_brush").transform.position; WheelBrush wb = GameObject.Find("Tools/WheelBrush").GetComponent <WheelBrush>(); string[] names = wb.LeftToBeCleaned.Split(new char[] { ',' }, System.StringSplitOptions.RemoveEmptyEntries); if (names.Length > 0) { int ind = Mathf.FloorToInt(Random.Range(0, names.Length)); if (GameObject.Find(names[ind]) != null) { endPos = GameObject.Find(names[ind]).transform.position + new Vector3(.5f, -.5f, 0); transform.position = startPos; StartPointing(); StartCoroutine("MovePoinnter"); } } } break; case "bubbles": if (GameObject.Find("TutPosStart_bubbles") != null) { startPos = GameObject.Find("TutPosStart_bubbles").transform.position; StartCoroutine("MovePoinnter_Bubbles"); } break; case "wax_car": if (GameObject.Find("TutPosStart_wax_car") != null) { startPos = GameObject.Find("TutPosStart_wax_car").transform.position; CleaningCloth cc = GameObject.Find("Tools/CleaningCloth").GetComponent <CleaningCloth>(); string[] names = cc.LeftToBeCleaned.Split(new char[] { ',' }, System.StringSplitOptions.RemoveEmptyEntries); if (names.Length > 0) { int ind = Mathf.FloorToInt(Random.Range(0, names.Length)); if (GameObject.Find(names[ind]) != null) { endPos = GameObject.Find(names[ind]).transform.position + new Vector3(.5f, -.5f, 0); transform.position = startPos; StartPointing(); StartCoroutine("MovePoinnter"); } } } break; case "polisher": if (GameObject.Find("TutPosStart_polisher") != null) { startPos = GameObject.Find("TutPosStart_polisher").transform.position; Polisher pol = GameObject.Find("Tools/Polisher").GetComponent <Polisher>(); string[] names = pol.LeftToBeCleaned.Split(new char[] { ',' }, System.StringSplitOptions.RemoveEmptyEntries); if (names.Length > 0) { int ind = Mathf.FloorToInt(Random.Range(0, names.Length)); if (GameObject.Find(names[ind]) != null) { endPos = GameObject.Find(names[ind]).transform.position + new Vector3(.5f, -.5f, 0); transform.position = startPos; StartPointing(); StartCoroutine("MovePoinnter"); } } } break; case "inflate_tires": if (GameObject.Find("TutPosStart_inflate_tires") != null) { startPos = GameObject.Find("TutPosStart_inflate_tires").transform.position; TirePump tp = GameObject.Find("Tools/TirePump").GetComponent <TirePump>(); string[] names = tp.LeftToBeCleaned.Split(new char[] { ',' }, System.StringSplitOptions.RemoveEmptyEntries); if (names.Length > 0) { int ind = Mathf.FloorToInt(Random.Range(0, names.Length)); if (GameObject.Find(names[ind] + "/Valwe") != null) { endPos = GameObject.Find(names[ind] + "/Valwe").transform.position + new Vector3(.5f, -.5f, 0); transform.position = startPos; StartPointing(); StartCoroutine("MovePoinnter"); } } } break; case "fuel": if (GameObject.Find("TutPosStart_fuel") != null) { startPos = GameObject.Find("TutPosStart_fuel").transform.position; endPos = GameObject.Find("FuelTank").transform.position + new Vector3(.5f, -.5f, 0); transform.position = startPos; StartPointing(); StartCoroutine("MovePoinnter"); } break; default: break; } }
void Start() { // tutorial = GameObject.Find("Tutorial").GetComponent<Tutorial>(); Shop.Instance.txtDispalyStars = null; starsCleanLeaves = 0; starsCleanBranches = 0; starsCleanDirt = 0; starsCleanStains = 0; starsCleanWheelBrush = 0; starsBubbles = 0; starsRotatingBrush = 0; starsWaxCar = 0; starsPolishCar = 0; starsInflateTires = 0; starsFuel = 0; Vector3 scale = Vector3.one; // * Screen.width*3f/(4f*Screen.height); bubblesHolder = GameObject.Find("CAR/Bubbles").transform; RotatingBrush = GameObject.Find("RotatingBrush2").transform; animRotatingBrush = RotatingBrush.GetChild(0).GetComponent <Animator>(); GasPump = GameObject.Find("GasPump").transform; GasPump.localScale = scale; FuelTank = GameObject.Find("FuelTank").transform; TirePump = GameObject.Find("Tools/TirePump").transform; TirePump.localScale = scale; //waterHose = GameObject.Find("Tools/WaterHose").transform; //waterHose.localScale = scale; cleningCloth = GameObject.Find("Tools/CleaningCloth").transform; cleningCloth.localScale = scale; sponge = GameObject.Find("Tools/Sponge").transform; sponge.localScale = scale; wheelBrush = GameObject.Find("Tools/WheelBrush").transform; wheelBrush.localScale = scale; leafBlower = GameObject.Find("Tools/LeafBlower").transform; leafBlower.localScale = scale; shears = GameObject.Find("Tools/Shears").transform; shears.localScale = new Vector3(-scale.x, scale.y, scale.z); polisher = GameObject.Find("Tools/Polisher").transform; polisher.localScale = scale; waterGun = GameObject.Find("Tools2/Compressor/WaterGun").GetComponent <WaterGun>(); waterHose = GameObject.Find("Tools2/WaterHose/Nozzle").GetComponent <WaterHose>(); DisableAllTools(); LevelTransition.Instance.ShowScene(); LevelTransition.bFirstStart = false; }