Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        if (!hasStarted)
        {
            if (cellsStill())
            {
                hasStarted = true;
            }
        }
        else
        {
            if (!isFinished)
            {
                //turn large cells into rooms;
                setRooms();

                //initalize the triangulation
                theDTController.setupTriangulation(roomList);

                isFinished = true;
            }
            else
            {
                if (!DTFinished)
                {
                    if (!theDTController.getDTDone())
                    {
                        theDTController.Update();
                    }
                    else
                    {
                        DTFinished = true;
                        thePrimController.setUpPrims(roomList, theDTController.getTriangulation());
                    }
                }
                else
                {
                    if (!PrimFinished)
                    {
                        thePrimController.Update();
                        PrimFinished = true;
                    }
                }
            }
        }
    }
Esempio n. 2
0
    // Update is called once per frame
    void Update()
    {
        if (!hasStarted)
        {
            if (cellsStill())
            {
                hasStarted = true;
            }
        }
        else
        {
            if (!isFinished)
            {
                //turn large cells into rooms;
                setRooms();

                //initalize the triangulation
                theDTController.setupTriangulation(roomList);

                isFinished = true;
            }
            else
            {
                if (!DTFinished)
                {
                    if (!theDTController.getDTDone())
                    {
                        theDTController.Update();
                    }
                    else
                    {
                        DTFinished = true;
                        thePrimController.setUpPrims(roomList, theDTController.getTriangulation());
                    }
                }
                else
                {
                    if (!PrimFinished)
                    {
                        thePrimController.Update();

                        if (Input.GetMouseButtonDown(0))
                        {
                            thePrimController.stopEdgeDraw();
                            PrimFinished = true;

                            theConverter = new scConvertTo3D(cellList, roomList, thePrimController);
                        }
                    }
                    else
                    {
                        //wait one frame before continueing the conversion for materials to initialize
                        if (!doFrame)
                        {
                            theConverter.doGen();
                            doFrame = true;
                        }
                    }
                }
            }
        }
    }
Esempio n. 3
0
    // Update is called once per frame
    void Update()
    {
        if (!noNeed)
        {
            if (!hasStarted)
            {
                if (cellsStill())
                {
                    hasStarted = true;
                }
            }
            else
            {
                if (!isFinished)
                {
                    //turn large cells into rooms;
                    setRooms();

                    //initalize the triangulation
                    theDTController.setupTriangulation(roomList);

                    isFinished = true;
                }
                else
                {
                    if (!DTFinished)
                    {
                        if (!theDTController.getDTDone())
                        {
                            theDTController.Update();
                        }
                        else
                        {
                            DTFinished = true;
                            thePrimController.setUpPrims(roomList, theDTController.getTriangulation());
                        }
                    }
                    else
                    {
                        if (!PrimFinished)
                        {
                            List <GameObject> listEtape = new List <GameObject>();
                            thePrimController.Update();
                            foreach (scVertexNode aNode in roomList)
                            {
                                aNode.getParentCell().AddComponent <ScEtape>();
                                listEtape.Add(aNode.getParentCell());
                            }
                            foreach (scEdge aEdge in thePrimController.getConnections())
                            {
                                aEdge.getNode0().getParentCell().GetComponent <ScEtape>().addConnection(aEdge.getNode1().getParentCell());
                                aEdge.getNode1().getParentCell().GetComponent <ScEtape>().addConnection(aEdge.getNode0().getParentCell());
                            }
                            PrimFinished = true;
                            Debug.Log(listEtape);
                            Debug.Log(thePrimController.edgesInTree);
                            List <GameObject> dirtyObject = new List <GameObject>();
                            foreach (GameObject g in listEtape)
                            {
                                if (!g.GetComponent <ScEtape>().hasConnexion())
                                {
                                    dirtyObject.Add(g);
                                }
                            }
                            listEtape.RemoveAll(r => !r.GetComponent <ScEtape>().hasConnexion());
                            foreach (GameObject g in dirtyObject)
                            {
                                Destroy(g);
                            }
                            foreach (GameObject g in GameObject.FindGameObjectsWithTag("Lines"))
                            {
                                if (g.name == "EdgeLine")
                                {
                                    g.SetActive(false);
                                }
                            }

                            cellHolder.gameObject.SetActive(false);
                            CarteService.instance.initialiseMap(listEtape);
                        }
                    }
                }
            }
        }
    }