コード例 #1
0
 // Update is called once per frame
 void Update()
 {
     for (int i = 0; i < uiImages.Length; i++)
     {
         Translucency translucency = uiImages [i].gameObject.GetComponent <Translucency>();
         translucency.SetTransparency(Transparency);
         translucency.SetGreyScale(GreyScale);
         translucency.SetBrightness(Brightness);
     }
 }
コード例 #2
0
        // Use this for initialization
        void Start()
        {
            uiImages = this.GetComponentsInChildren <Image> ();
            Shader   translucentImage = Shader.Find("Custom/Translucency");
            Material translucencyMat  = new Material(translucentImage);

            for (int i = 0; i < uiImages.Length; i++)
            {
                Translucency translucency = uiImages [i].gameObject.GetComponent <Translucency> ();
                if (translucency == null)
                {
                    translucency = uiImages [i].gameObject.AddComponent <Translucency>();
                    translucency.SetTranslucencyMaterial(translucencyMat);
                    translucency.SetTransparency(Transparency);
                    translucency.SetGreyScale(GreyScale);
                    translucency.SetBrightness(Brightness);
                }
            }
        }