示例#1
0
        virtual public void Update(UpdateContext context, float alpha)
        {
            if ((System.Object)meshFilter == null || _manager == null || (System.Object)mesh == null)
            {
                return;
            }

            if (_colorChanged || _alpha != alpha)
            {
                _colorChanged = false;
                _alpha        = alpha;

                Color32[] cols  = mesh.colors32;
                int       count = cols.Length;
                for (int i = 0; i < count; i++)
                {
                    Color32 col = cols[i];
                    int     j   = i / 4;
                    col.a   = (byte)(_alpha * quadAlpha[j]);
                    cols[i] = col;
                }
                mesh.colors32 = cols;
            }

            Material mat;

            if ((System.Object)_material != null)
            {
                mat = _material;
            }
            else
            {
                mat = _manager.GetContextMaterial(context);
            }
            if ((System.Object)mat != (System.Object)meshRenderer.sharedMaterial && (System.Object)mat.mainTexture != null)
            {
                meshRenderer.sharedMaterial = mat;
            }
        }
示例#2
0
        virtual public void Update(UpdateContext context)
        {
            if (_manager == null)
            {
                return;
            }

            Material mat;

            if ((object)_material != null)
            {
                mat = _material;
            }
            else
            {
                mat = _manager.GetContextMaterial(this, context);
            }
            if ((object)mat != (object)meshRenderer.sharedMaterial && (object)mat.mainTexture != null)
            {
                meshRenderer.sharedMaterial = mat;
            }
        }