public void OnTriggerStay(Collider other)
    {
        // IME BOXA
        string name = other.gameObject.transform.parent.name;

        // Krajnje tacke boxa
        Vector3[] verts = getCornersOfBoxCollider(other.gameObject);
        int       numOfVertsContained = 0;

        for (int i = 0; i < verts.Length; i++)
        {
            Debug.Log(verts[i]);
            Vector3 vec = verts[i];
            if (GetComponent <Collider>().bounds.Contains(verts[i]))
            {
                numOfVertsContained++;
            }
        }
        Debug.Log(numOfVertsContained);
        if (numOfVertsContained >= 4)
        {
            //OVDE UPADA KOD UKOLIKO JE KUTIJA NA TACNOJ POZICIJI
            GetComponent <MeshRenderer>().material = green;
            //GameObject.Destroy(other.gameObject);
            mtd.boxPlaced(name);
            ui.setUIALL(UIStatus.Green, "Box is on the place!", name, true, "Next");
        }
        else
        {
            GetComponent <MeshRenderer>().material = red;
            mtd.boxUnplaced(name);
            ui.setUIALL(UIStatus.Red, "Box is NOT on the place!", name, false, "Scan again");
        }
    }
Example #2
0
    public void startPacking()
    {
        Box nextBox = redModeRende.NextBox();

        if (nextBox == null)
        {
            ui.setUIALL(UIStatus.Grey, "All Boxex placed", "complete", false, "DONE");
            return;
        }
        string message = "Next box to be placed is: " + nextBox.Name;

        ui.setUIALL(UIStatus.Grey, message, nextBox.Name, false, "");
        currentBox = nextBox;
    }
    public void nextScan()
    {
        RenderBoxAtPosition renderBoxAtPosition = GameObject.FindObjectOfType <RenderBoxAtPosition>();

        renderBoxAtPosition.addToPlacedBoxList(ui.name);

        //radMode_RenderBoxesAtPosition redMode_RenderBoxesAt = GameObject.FindObjectOfType<radMode_RenderBoxesAtPosition>();


        mtd.destroyCollider(ui.name);
        mtd.boxPlaced(ui.name);

        ui.setUIALL(UIStatus.Grey, "Scan next box!", "", false, "Scan next");

        SoundManager soundManager = GameObject.FindObjectOfType <SoundManager>();

        soundManager.source.PlayOneShot(soundManager.box);

        GameObject objText = GameObject.FindGameObjectWithTag("box_num").gameObject;
        int        num;

        try
        {
            num = int.Parse((objText.GetComponent <Text>().text.Split(' '))[1]);
        }
        catch (System.Exception)
        {
            num = 0;
        }
        objText.GetComponent <Text>().text = "No. " + ++num;

        mtd.enableMultiTargets();
    }
    public void nextScan()
    {
        mtd.destroyCollider(ui.name);
        mtd.boxPlaced(ui.name);
        mtd.enableMultiTargets();
        ui.setUIALL(UIStatus.Grey, "Scan next box!", "", false, "Scan next");

        SoundManager soundManager = GameObject.FindObjectOfType <SoundManager>();

        soundManager.source.PlayOneShot(soundManager.box);
    }
Example #5
0
    public void StageOnlyOnce()
    {
        this.gameObject.GetComponent <AnchorInputListenerBehaviour>().gameObject.SetActive(false);
        this.gameObject.GetComponent <PlaneFinderBehaviour>().gameObject.SetActive(false);
        UI_Main ui = GameObject.FindObjectOfType <UI_Main>();

        //ui_main.setUiStatusText("Ground plane setted.");
        //ui_main.setUiStatusButtonText("Scan next");
        //ui_main.setUiStatusBtnInteractable(true);
        if (SceneManager.GetActiveScene().name == "RandomModeSCENA")
        {
            ui.setUIALL(UIStatus.Green, "Scan the boxes u want to place!", "", true, "Finish scaning");
        }
        else
        {
            ui.setUIALL(UIStatus.Green, "Ground plane placed successfuly!", "", false, "Scan box");
        }
        MultiTargetDisabler mtd = GameObject.FindObjectOfType <MultiTargetDisabler>();

        mtd.enableMultiTargets();
    }
    public void OnTriggerStay(Collider other)
    {
        // IME BOXA
        string name = other.gameObject.transform.parent.name;

        // Krajnje tacke boxa
        Vector3[] verts = getCornersOfBoxCollider(other.gameObject.GetComponent <Collider>().gameObject);
        int       numOfVertsContained = 0;
        Bounds    bd = GetComponent <Collider>().bounds;

        if (bd.Contains(verts[0]) && bd.Contains(verts[1]) && bd.Contains(verts[4]) && bd.Contains(verts[5]))
        {
            numOfVertsContained += 4;
        }
        if (bd.Contains(verts[2]) && bd.Contains(verts[3]) && bd.Contains(verts[6]) && bd.Contains(verts[7]))
        {
            numOfVertsContained += 4;
        }

        for (int i = 0; i < verts.Length; i++)
        {
            if (bd.Contains(verts[i]))
            {
                numOfVertsContained++;
            }
        }
        Debug.Log(numOfVertsContained);
        if (numOfVertsContained >= 4)
        {
            //OVDE UPADA KOD UKOLIKO JE KUTIJA NA TACNOJ POZICIJI
            GetComponent <MeshRenderer>().material = green;
            ui.setUIALL(UIStatus.Green, "Box is on the place!", name, true, "Next");
        }
        else
        {
            GetComponent <MeshRenderer>().material = red;
            ui.setUIALL(UIStatus.Red, "Box is NOT on the place!", name, false, "Scan again");
        }
    }
Example #7
0
    public void StageOnlyOnce()
    {
        this.gameObject.GetComponent <AnchorInputListenerBehaviour>().gameObject.SetActive(false);
        this.gameObject.GetComponent <PlaneFinderBehaviour>().gameObject.SetActive(false);
        UI_Main ui = GameObject.FindObjectOfType <UI_Main>();

        //ui_main.setUiStatusText("Ground plane setted.");
        //ui_main.setUiStatusButtonText("Scan next");
        //ui_main.setUiStatusBtnInteractable(true);
        ui.setUIALL(UIStatus.Green, "Ground plane placed successfuly!", "", false, "Scan box");
        MultiTargetDisabler mtd = GameObject.FindObjectOfType <MultiTargetDisabler>();

        mtd.enableMultiTargets();
    }
    public void BoxScaned(string boxName)
    {
        Vector3 size     = xmlReader.getSizeByName(boxName);
        Vector3 position = this.paletPosition[boxName];
        Box     tmp      = this.scanBoxes.Find(el => el.Name == boxName);

        if (tmp == null)
        {
            this.scanBoxes.Add(new Box(boxName, size, position));
            SoundManager soundManager = GameObject.FindObjectOfType <SoundManager>();
            soundManager.source.Play(0);
            UI_Main ui = GameObject.FindObjectOfType <UI_Main>();
            // ui.setUiStatusSprite(boxName);
            ui.setUIALL(UIStatus.Grey, "Number of boxes scaned: " + this.scanBoxes.Count, boxName, true, "Finish scaning");
        }
    }
Example #9
0
 private void WrongBox(string name)
 {
     uiMain.setUIALL(UIStatus.Red, "Please scan right box!", "", false, "Scan box");
 }