Ejemplo n.º 1
0
 private static void ToggleBeamAnimation(Workbench workbench, bool active)
 {
     workbench.GetData().animatingBeams = active;
     try
     {
         workbench.workingLight.SetActive(active);
         workbench.animator.SetBool(AnimatorHashID.working, active);
         var sparks = (GameObject[])sparksField.GetValue(workbench);
         var beams  = workbench.fxLaserBeam;
         for (var i = 0; i < beams.Length; i++)
         {
             beams[i].SetActive(active);
             var ps = sparks[i].GetComponent <ParticleSystem>();
             if (active)
             {
                 ps.Play();
             }
             else
             {
                 ps.Stop();
             }
         }
     }
     catch (Exception e) { AGLogger.ExceptionOnce(e); }
 }
Ejemplo n.º 2
0
 private static void UpdateAnimation(Workbench workbench)
 {
     try
     {
         var light = workbench.workingLight.GetComponent <Light>();
         light.intensity *= 2;
         var sparks     = (GameObject[])sparksField.GetValue(workbench);
         var beams      = workbench.fxLaserBeam;
         var spawnPoint = workbench.ghost.itemSpawnPoint;
         for (var i = 0; i < sparks.Length; i++)
         {
             var laser = beams[i].transform;
             sparks[i].transform.position = GetBeamEnd(laser.position, laser.forward, spawnPoint.position, spawnPoint.up);
         }
     }
     catch (Exception e) { AGLogger.ExceptionOnce(e); }
 }