Exemple #1
0
        internal static void ApplyColorOrFill <T>(T fillable, ShapeFill fill, Color baseColor) where T : MetaMpb, IFillable
        {
            bool useFill = fill != null;

            fillable.color.Add(useFill ? fill.colorStart : baseColor);
            fillable.fillType.Add(fill.GetShaderFillModeInt());
            fillable.fillSpace.Add(useFill ? (float)fill.space : default);
Exemple #2
0
        static void TryApplyFillAndColor(Material mat, ShapeFill fill, Color defaultColor)
        {
            bool useFill = fill != null;

            mat.SetColor(ShapesMaterialUtils.propColor, useFill ? fill.colorStart : defaultColor);
            mat.SetInt(ShapesMaterialUtils.propFillType, fill.GetShaderFillModeInt());
            if (useFill)
            {
                mat.SetInt(ShapesMaterialUtils.propFillSpace, (int)fill.space);
                mat.SetVector(ShapesMaterialUtils.propFillStart, fill.GetShaderStartVector());
                mat.SetColor(ShapesMaterialUtils.propColorEnd, fill.colorEnd);
                if (fill.type == FillType.LinearGradient)
                {
                    mat.SetVector(ShapesMaterialUtils.propFillEnd, fill.linearEnd);
                }
            }
        }