예제 #1
0
        public override void Init(GameObject host, InteractableThemePropertySettings settings)
        {
            base.Init(host, settings);

            shaderProperties = new List <ShaderProperties>();
            for (int i = 0; i < ThemeProperties.Count; i++)
            {
                InteractableThemeProperty prop = ThemeProperties[i];
                if (prop.ShaderOptions.Count > 0)
                {
                    shaderProperties.Add(prop.ShaderOptions[prop.PropId]);
                }
            }

            propertyBlocks = new List <BlocksAndRenderer>();
            Renderer[] list = host.GetComponentsInChildren <Renderer>();
            for (int i = 0; i < list.Length; i++)
            {
                MaterialPropertyBlock block = InteractableThemeShaderUtils.GetMaterialPropertyBlock(list[i].gameObject, shaderProperties.ToArray());
                BlocksAndRenderer     bAndR = new BlocksAndRenderer();
                bAndR.Renderer = list[i];
                bAndR.Block    = block;

                propertyBlocks.Add(bAndR);
            }
        }
예제 #2
0
        public static float GetFloat(GameObject host, string propId)
        {
            if (host == null)
            {
                return(0);
            }

            MaterialPropertyBlock block = InteractableThemeShaderUtils.GetPropertyBlock(host);

            return(block.GetFloat(propId));
        }
예제 #3
0
        public static Color GetColor(GameObject host, string propId)
        {
            if (host == null)
            {
                return(Color.white);
            }

            MaterialPropertyBlock block = InteractableThemeShaderUtils.GetPropertyBlock(host);

            return(block.GetVector(propId));
        }
예제 #4
0
        public override void Init(GameObject host, InteractableThemePropertySettings settings)
        {
            base.Init(host, settings);

            shaderProperties = new List <ShaderProperties>();
            for (int i = 0; i < ThemeProperties.Count; i++)
            {
                InteractableThemeProperty prop = ThemeProperties[i];
                if (prop.ShaderOptions.Count > 0)
                {
                    shaderProperties.Add(prop.ShaderOptions[prop.PropId]);
                }
            }

            propertyBlock = InteractableThemeShaderUtils.GetMaterialPropertyBlock(host, shaderProperties.ToArray());
        }
예제 #5
0
 public override void Init(GameObject host, InteractableThemePropertySettings settings)
 {
     base.Init(host, settings);
     propertyBlock = InteractableThemeShaderUtils.GetMaterialPropertyBlock(host, new ShaderProperties[0]);
     renderer      = Host.GetComponent <Renderer>();
 }