Exemplo n.º 1
0
        public new IMagazine GetMagazine(Polisher polisher)
        {
            _logger.Debug(_moduleName, string.Format("{0}.GetMagazine({1})", typeof(PolishLinePlc).Name, polisher));
            IMagazine ret = base.GetMagazine(polisher);
            _logger.Debug(_moduleName, string.Format("{0}.GetMagazine({1} result: {2})", typeof(PolishLinePlc).Name, polisher, ret.ToString()));

            return ret;
        }
Exemplo n.º 2
0
 public int ConvertPolisherToInt(Polisher polisher)
 {
     switch (polisher)
     {
         case Polisher.Polisher1:
             return 0;
         case Polisher.Polisher2:
             return 1;
         case Polisher.Polisher3:
             return 2;
         default:
             throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Argument does not match enumeration type Polisher, actual value is '{0}'.", polisher));
     }
 }
Exemplo n.º 3
0
 public IMagazine GetMagazine(Polisher polisher)
 {
     return ReadMemory<MagazineFromStreamConverter, Magazine>(haMachinesStatus + ConvertPolisherToInt(polisher) * 64, 20);
 }
Exemplo n.º 4
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;
        }
    }