コード例 #1
0
        public static IEnumerator GpsRun()
        {
            ++OpenCoRoutes;

            yield return(new WaitForSecondsRealtime(1));

            if (OpenCoRoutes-- > 1)
            {
                yield break;
            }

#if (DEBUG)
            Debug.Log("Attempting to remove null objects!");
#endif
            Objects = Objects
                      .Where(p => p != null)
                      .ToList();

#if (DEBUG)
            Debug.Log($"Collecting materials and pushing them to the material editor: {Objects.Count}");
#endif

            var renders = Objects
                          .Where(o => o != null)
                          .Select(o => o.transform)
                          .Where(t => t != null)
                          .Select(t => t.GetComponentsInChildren <Transform>(true))
                          .Where(ts => ts != null)
                          .SelectMany(ts => ts)
                          .Select(t => t.GetComponent <Renderer>())
                          .Where(r => r != null)
                          .ToList();

            renders.ForEach(r => Init.instance.StartCoroutine(ModShadows.Run(r, Init.Props)));

            var materials =
                renders
                .Where(r => r.materials != null)
                .SelectMany(r => r.materials)
                .ToList();

#if (DEBUG)
            Debug.Log($"Gathered this many materials: {materials.Count}");
#endif

            materials.ForEach(m => Init.instance.StartCoroutine(ModMat.Run(m, Init.Props)));

#if (DEBUG)
            Debug.Log("Done!");
#endif
        }
コード例 #2
0
        public static IEnumerator BgRun()
        {
            ++OpenCoRoutes;

            yield return(new WaitForSecondsRealtime(1));

            if (OpenCoRoutes-- > 1)
            {
                yield break;
            }

#if (DEBUG)
            Debug.Log($"Collecting materials and pushing them to the material editor");
#endif

            var renders = Background
                          .transform
                          .GetComponentsInChildren <Transform>(true)
                          .Select(t => t)
                          .Where(ts => ts != null)
                          .Select(t => t.GetComponent <Renderer>())
                          .Where(r => r != null)
                          .ToList();

#if (DEBUG)
            Debug.Log($"Collected Renderers");
#endif

            renders.ForEach(r => Init.instance.StartCoroutine(ModShadows.Run(r, Init.Bg)));

#if (DEBUG)
            Debug.Log($"Manipulated Shadows");
#endif

            var materials =
                renders
                .Where(r => r.materials != null)
                .SelectMany(r => r.materials)
                .ToList();

#if (DEBUG)
            Debug.Log($"Gathered this many materials: {materials.Count}");
#endif

            materials.ForEach(m => Init.instance.StartCoroutine(ModMat.Run(m, Init.Bg)));

#if (DEBUG)
            Debug.Log("Done!");
#endif
        }