Exemple #1
0
 static MaterialFix()
 {
     try
     {
         //var prefab = CraftData.GetPrefabForTechType(TechType.Workbench, true);
         var workbench = Resources.Load <GameObject>("Submarine/Build/Workbench").GetComponent <Workbench>();
         var material  = workbench.fxLaserBeam[0].GetComponent <Renderer>().sharedMaterial;
         var func      = AnimationFuncs.SinusoidalColor(min, max, frequency);
         var anim      = new ShaderColorPropertyAnimation(ShaderPropertyID._Color, func);
         anim.Play(material);
     }
     catch (Exception e) { AGLogger.Exception(e); }
 }
                static BeamMaterial()
                {
                    try
                    {
                        var prefab = CraftData.GetPrefabForTechType(TechType.Workbench);
                        original = prefab.GetComponent <Workbench>().fxLaserBeam[0].GetComponent <Renderer>().sharedMaterial;
                        custom   = new Material(original);

                        var func = AnimationFuncs.SinusoidalColor(Config.BeamColor, Config.BeamAlphaColor, Config.BeamFrequency);
                        var anim = new ShaderColorPropertyAnimation(ShaderPropertyID._Color, func);
                        anim.Play(custom);
                    }
                    catch (Exception e) { AGLogger.Exception(e); }
                }
                private static IEnumerator GetMaterials()
                {
                    CoroutineTask <GameObject> task = CraftData.GetPrefabForTechTypeAsync(TechType.Fabricator, false);

                    yield return(task);

                    GameObject prefab = task.GetResult();

                    original = prefab.GetComponent <Fabricator>().leftBeam.GetComponent <Renderer>().sharedMaterial;
                    custom   = new Material(original);

                    var func = AnimationFuncs.SinusoidalColor(Config.BeamColor, Config.BeamAlphaColor, Config.BeamFrequency);
                    var anim = new ShaderColorPropertyAnimation(ShaderPropertyID._TintColor, func);

                    anim.Play(custom);
                }