Esempio n. 1
0
        private void ProcessQueue()
        {
            if (_queue.Count > 0 && !_running)
            {
                MeshBuilderVO vo = _queue [0];

                _running        = true;
                _finishedAction = vo.CompletedHandler;
                _useThread      = vo.Thread;
                _vertexColor    = vo.Col;
                _material       = vo.Mat;
                _rebuild        = vo.Rebuild;
                _reusedMesh     = vo.ReusedMesh;
                _reusedShape    = vo.ReusedShape;
                Build(vo.Points);
            }
        }
Esempio n. 2
0
        public void Build(List <Vector2> points, Action <Shape> completedHandler, Color color, Material material, bool useThread, bool rebuild, GameObject obj = null)
        {
            if (_queue == null)
            {
                _queue = new List <MeshBuilderVO>();
            }

            MeshBuilderVO vo = new MeshBuilderVO();

            vo.Points           = points;
            vo.CompletedHandler = completedHandler;
            vo.Thread           = useThread;
            vo.Col     = color;
            vo.Rebuild = rebuild;
            if (rebuild)
            {
                vo.ReusedShape = obj.GetComponent <Shape>();
                vo.ReusedMesh  = obj.GetComponent <MeshFilter>().sharedMesh;
            }

            if (material == null)
            {
                if (_basicMaterial == null)
                {
                    _basicMaterial = Resources.Load("Basic2DMaterial") as Material;
                }
                vo.Mat = _basicMaterial;
            }
            else
            {
                vo.Mat = material;
            }
            _queue.Add(vo);
            if (!_running)
            {
                ProcessQueue();
            }
        }
Esempio n. 3
0
        public void Build(List<Vector2> points, Action<Shape> completedHandler, Color color, Material material, bool useThread, bool rebuild, GameObject obj = null)
        {
            if (_queue == null)
            {
                _queue = new List<MeshBuilderVO>();
            }

            MeshBuilderVO vo = new MeshBuilderVO();

            vo.Points = points;
            vo.CompletedHandler = completedHandler;
            vo.Thread = useThread;
            vo.Col = color;
            vo.Rebuild = rebuild;
            if(rebuild)
            {
                vo.ReusedShape = obj.GetComponent<Shape>();
                vo.ReusedMesh = obj.GetComponent<MeshFilter>().sharedMesh;
            }

            if (material == null)
            {
                if(_basicMaterial == null)
                {
                    _basicMaterial = Resources.Load("Basic2DMaterial") as Material;
                }
                vo.Mat = _basicMaterial;
            }
            else
            {
                vo.Mat = material;
            }
            _queue.Add(vo);
            if (!_running)
            {
                ProcessQueue();
            }
        }