Esempio n. 1
0
    //build map
    void BuildMap()
    {
        if (creator.firstTimeBuild)
        {
            creator.BuildMapComplete(false, false, false);
        }
        else
        {
            Vector3 _p = this.transform.position;
            //this is a custom optimization loop because we are using a radius
            //instead of just a single point position
            for (int l = 0; l < creator.configuration.global.layerCount; l++)
            {
                for (int rY = -radius; rY < radius; rY++)
                {
                    for (int rX = -radius; rX < radius; rX++)
                    {
                        creator.OptimizePassPartial(l, (int)_p.x + rX, (int)_p.z + rY);
                    }
                }
            }

            creator.BuildMapPartial(false, true);
        }
    }
Esempio n. 2
0
        //build map if user has clicked and automatic build is enabled
        void BuildMap()
        {
            if (creator.configuration.ui.autoBuild)
            {
                for (int l = 0; l < creator.configuration.global.layerCount; l++)
                {
                    for (int i = 0; i < 4; i++)
                    {
                        for (int c = 0; c < cellMap.GetLength(0); c++)
                        {
                            for (int d = 0; d < cellMap.GetLength(1); d++)
                            {
                                if (cellInstancedMap[c, d])
                                {
                                    creator.OptimizePassPartial(l, c, d);
                                }
                            }
                        }
                    }
                }


                if (creator.firstTimeBuild)
                {
                    creator.BuildMapComplete(false, false, true);
                }
                else
                {
                    if (creator.configuration.global.buildOverlappingTiles)
                    {
                        //set optimization to false because we do the optmizitation above
                        //creator.BuildMapPartial(false, false, 0, 0);
                        creator.BuildMapPartial(false, false);
                    }
                    else
                    {
                        creator.firstTimeBuild = true;

                        creator.BuildMapComplete(false, false, true);
                    }
                }
                //reset the painted cells
                ResetCells();
            }
        }