public static Material FadedVersionOf(Material sourceMat, float alpha)
        {
            int num = FadedMaterialPool.IndexFromAlpha(alpha);

            switch (num)
            {
            case 0:
                return(BaseContent.ClearMat);

            case 29:
                return(sourceMat);

            default:
            {
                FadedMatRequest key      = new FadedMatRequest(sourceMat, num);
                Material        material = default(Material);
                if (!FadedMaterialPool.cachedMats.TryGetValue(key, out material))
                {
                    material       = new Material(sourceMat);
                    material.color = new Color(1f, 1f, 1f, (float)((float)FadedMaterialPool.IndexFromAlpha(alpha) / 30.0));
                    FadedMaterialPool.cachedMats.Add(key, material);
                }
                return(material);
            }
            }
        }
Esempio n. 2
0
        public static Material FadedVersionOf(Material sourceMat, float alpha)
        {
            int      num = FadedMaterialPool.IndexFromAlpha(alpha);
            Material result;

            if (num == 0)
            {
                result = BaseContent.ClearMat;
            }
            else if (num == 29)
            {
                result = sourceMat;
            }
            else
            {
                FadedMaterialPool.FadedMatRequest key = new FadedMaterialPool.FadedMatRequest(sourceMat, num);
                Material material;
                if (!FadedMaterialPool.cachedMats.TryGetValue(key, out material))
                {
                    material       = MaterialAllocator.Create(sourceMat);
                    material.color = new Color(1f, 1f, 1f, (float)FadedMaterialPool.IndexFromAlpha(alpha) / 30f);
                    FadedMaterialPool.cachedMats.Add(key, material);
                }
                result = material;
            }
            return(result);
        }
Esempio n. 3
0
        public static Material FadedVersionOf(Material sourceMat, float alpha)
        {
            int num = FadedMaterialPool.IndexFromAlpha(alpha);

            if (num == 0)
            {
                return(BaseContent.ClearMat);
            }
            if (num == 29)
            {
                return(sourceMat);
            }
            FadedMaterialPool.FadedMatRequest key = new FadedMaterialPool.FadedMatRequest(sourceMat, num);
            Material material;

            if (!FadedMaterialPool.cachedMats.TryGetValue(key, out material))
            {
                material       = new Material(sourceMat);
                material.color = new Color(1f, 1f, 1f, (float)FadedMaterialPool.IndexFromAlpha(alpha) / 30f);
                FadedMaterialPool.cachedMats.Add(key, material);
            }
            return(material);
        }