コード例 #1
0
        public override InteractableThemePropertyValue GetProperty(InteractableThemeProperty property)
        {
            if (Host == null)
            {
                return(emptyValue);
            }

            renderer.GetPropertyBlock(propertyBlock);

            startValue.Reset();

            int propId = property.GetShaderPropertyId();

            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);
        }
コード例 #2
0
        public override void SetValue(InteractableThemeProperty property, int index, float percentage)
        {
            if (Host == null)
            {
                return;
            }

            renderer.GetPropertyBlock(propertyBlock);

            int   propId = property.GetShaderPropertyId();
            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);
        }
コード例 #3
0
        /// <inheritdoc />
        public override void SetValue(InteractableThemeProperty property, int index, float percentage)
        {
            Color color = Color.Lerp(property.StartValue.Color, property.Values[index].Color, percentage);

            int propId = property.GetShaderPropertyId();

            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;
            }
        }
コード例 #4
0
        /// <inheritdoc />
        public override InteractableThemePropertyValue GetProperty(InteractableThemeProperty property)
        {
            InteractableThemePropertyValue color = new InteractableThemePropertyValue();

            int propId = property.GetShaderPropertyId();

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

            return(color);
        }