public override InteractableThemePropertyValue GetProperty(InteractableThemeProperty property)
        {
            if (Host == null)
            {
                return(emptyValue);
            }

            startValue.Reset();

            string propId = property.GetShaderPropId();

            switch (property.Type)
            {
            case InteractableThemePropertyValueTypes.Color:
                startValue.Color = propertyBlock.GetVector(propId);
                break;

            case InteractableThemePropertyValueTypes.ShaderFloat:
                startValue.Float = propertyBlock.GetFloat(propId);
                break;

            case InteractableThemePropertyValueTypes.shaderRange:
                startValue.Float = propertyBlock.GetFloat(propId);
                break;

            default:
                break;
            }

            return(startValue);
        }
        public override void SetValue(InteractableThemeProperty property, int index, float percentage)
        {
            if (Host == null)
            {
                return;
            }

            string propId = property.GetShaderPropId();
            float  newValue;

            switch (property.Type)
            {
            case InteractableThemePropertyValueTypes.Color:
                Color newColor = Color.Lerp(property.StartValue.Color, property.Values[index].Color, percentage);
                propertyBlock = SetColor(propertyBlock, newColor, propId);
                break;

            case InteractableThemePropertyValueTypes.ShaderFloat:
                newValue      = LerpFloat(property.StartValue.Float, property.Values[index].Float, percentage);
                propertyBlock = SetFloat(propertyBlock, newValue, propId);
                break;

            case InteractableThemePropertyValueTypes.shaderRange:
                newValue      = LerpFloat(property.StartValue.Float, property.Values[index].Float, percentage);
                propertyBlock = SetFloat(propertyBlock, newValue, propId);
                break;

            default:
                break;
            }

            renderer.SetPropertyBlock(propertyBlock);
        }
Exemplo n.º 3
0
        public override void SetValue(InteractableThemeProperty property, int index, float percentage)
        {
            Color color = Color.Lerp(property.StartValue.Color, property.Values[index].Color, percentage);

            string propId = property.GetShaderPropId();

            for (int i = 0; i < propertyBlocks.Count; i++)
            {
                BlocksAndRenderer bAndR = propertyBlocks[i];
                bAndR.Block.SetColor(propId, color);
                bAndR.Renderer.SetPropertyBlock(bAndR.Block);
                propertyBlocks[i] = bAndR;
            }
        }
Exemplo n.º 4
0
        public override InteractableThemePropertyValue GetProperty(InteractableThemeProperty property)
        {
            InteractableThemePropertyValue color = new InteractableThemePropertyValue();

            string propId = property.GetShaderPropId();

            if (propertyBlocks.Count > 0)
            {
                BlocksAndRenderer bAndR = propertyBlocks[0];
                color.Color = bAndR.Block.GetVector(propId);
            }

            return(color);
        }