Esempio n. 1
0
 private static bool TryCreateModParticleParams(Workbench workbench)
 {
     if (modParticlesParams != null)
     {
         return(true);
     }
     try
     {
         var sparks = ((GameObject[])sparksField.GetValue(workbench))[0].GetComponent <ParticleSystem>();
         originParticlesParams = new ParticleSystemParameters()
         {
             startColor = sparks.main.startColor
         };
         modParticlesParams = new ParticleSystemParameters()
         {
             startColor = Config.BeamAlphaColor
         };
         return(true);
     }
     catch (Exception e)
     {
         AGLogger.Exception(e);
         return(false);
     }
 }
Esempio n. 2
0
 private static bool TryCreateModParticleParams(Fabricator fabricator)
 {
     if (modParticlesParams != null)
     {
         return(true);
     }
     try
     {
         var sparksL = ((GameObject)sparksLFieldInfo.GetValue(fabricator)).GetComponent <ParticleSystem>();
         originParticlesParams = new ParticleSystemParameters()
         {
             startColor = sparksL.main.startColor
         };
         modParticlesParams = new ParticleSystemParameters()
         {
             startColor = Config.BeamAlphaColor
         };
         return(true);
     }
     catch (Exception e)
     {
         AGLogger.Exception(e);
         return(false);
     }
 }
Esempio n. 3
0
 private static void SetWorkbenchLightColor(Workbench workbench, Color color)
 {
     try
     {
         workbench.workingLight.GetComponent <Light>().color = color;
     }
     catch (Exception e) { AGLogger.Exception(e); }
 }
Esempio n. 4
0
 private static void SetFabricatorLightColor(Fabricator fabricator, Color color)
 {
     try
     {
         fabricator.fabLight.color = color;
     }
     catch (Exception e) { AGLogger.Exception(e); }
 }
Esempio n. 5
0
 private static void SetFabricatorBeamsMaterial(Fabricator fabricator, Material material)
 {
     try
     {
         fabricator.leftBeam.GetComponent <Renderer>().material  = material;
         fabricator.rightBeam.GetComponent <Renderer>().material = material;
     }
     catch (Exception e) { AGLogger.Exception(e); }
 }
Esempio n. 6
0
 private static void SetWorkbenchBeamsMaterial(Workbench workbench, Material material)
 {
     try
     {
         foreach (var beam in workbench.fxLaserBeam)
         {
             beam.GetComponent <Renderer>().material = material;
         }
     }
     catch (Exception e) { AGLogger.Exception(e); }
 }
Esempio n. 7
0
 private static void SetFabricatorParticlesParams(Fabricator fabricator, ParticleSystemParameters @params)
 {
     try
     {
         var sparksL = ((GameObject)sparksLFieldInfo.GetValue(fabricator)).GetComponent <ParticleSystem>();
         var sparksR = ((GameObject)sparksRFieldInfo.GetValue(fabricator)).GetComponent <ParticleSystem>();
         @params.Apply(sparksL);
         @params.Apply(sparksR);
     }
     catch (Exception e) { AGLogger.Exception(e); }
 }
Esempio n. 8
0
 private static void SetWorkbenchParticlesParams(Workbench workbench, ParticleSystemParameters @params)
 {
     try
     {
         var sparks = (GameObject[])sparksField.GetValue(workbench);
         foreach (var spark in sparks)
         {
             @params.Apply(spark.GetComponent <ParticleSystem>());
         }
     }
     catch (Exception e) { AGLogger.Exception(e); }
 }
Esempio n. 9
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); }
                }
Esempio n. 11
0
 private static bool TryCreateModLightColor(Workbench workbench)
 {
     if (originLightColor != null)
     {
         return(true);
     }
     try
     {
         originLightColor = workbench.workingLight.GetComponent <Light>().color;
         modLightColor    = Config.BeamColor;
         return(true);
     }
     catch (Exception e)
     {
         AGLogger.Exception(e);
         return(false);
     }
 }
Esempio n. 12
0
 private static bool TryCreateModLightColor(Fabricator fabricator)
 {
     if (originLightColor != null)
     {
         return(true);
     }
     try
     {
         originLightColor = fabricator.fabLight.color;
         modLightColor    = Config.BeamColor;
         return(true);
     }
     catch (Exception e)
     {
         AGLogger.Exception(e);
         return(false);
     }
 }