// Start is called before the first frame update
 void Start()
 {
     leafBlower         = FindObjectOfType <LeafBlower>();
     saveLoader         = FindObjectOfType <SaveLoader>();
     scoreKeeper        = FindObjectOfType <ScoreKeeper>();
     antonymsSfxManager = FindObjectOfType <AntonymsSfxManager>();
 }
Пример #2
0
    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;
        }
    }