Пример #1
0
        public Material GetModifiedMaterial(Material baseMaterial)
        {
            if (!enabled)
            {
                return(baseMaterial);
            }

            if (rectParent == null)
            {
                rectParent = GetComponentInParent <RectSoftAlphaMask>();
                if (rectParent == null)
                {
#if UNITY_EDITOR
                    if (Application.isEditor)
                    {
                        Object.DestroyImmediate(this);
                    }
                    else
                    {
                        Object.Destroy(this);
                    }
#else
                    Object.Destroy(this);
#endif
                    return(baseMaterial);
                }
            }

            if (!rectParent.enabled)
            {
                return(baseMaterial);
            }

            return(rectParent.GetDefaultMaterial(baseMaterial));
        }
Пример #2
0
        public void Set()
        {
            if (mTotalMateiral == 0)
            {
                return;
            }

            RectSoftAlphaMask mask = GetComponentInParent <RectSoftAlphaMask>();

            if (mask == null)
            {
                return;
            }

            for (int i = 0; i < mDatas.Count; ++i)
            {
                mDatas[i].Set(mask);
            }
        }
Пример #3
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            RectSoftAlphaMask mask     = target as RectSoftAlphaMask;
            Vector4           softEdge = mask.SoftEdge;

            EditorGUILayout.LabelField("软裁剪边");
            GUI.changed = false;
            softEdge.x  = EditorGUILayout.FloatField("左边", softEdge.x);
            softEdge.w  = EditorGUILayout.FloatField("顶边", softEdge.w);
            softEdge.z  = EditorGUILayout.FloatField("右边", softEdge.z);
            softEdge.y  = EditorGUILayout.FloatField("底边", softEdge.y);

            mask.SoftEdge = softEdge;

            if (GUI.changed)
            {
                mask.Update();
            }
        }