Пример #1
0
 public void CheckElementalInputs()
 {
     if (currentPlanet != null)
     {
         if (hydrogenButton.IsClicked())
         {
             if (hydrogen > 0 && currentPlanet.GetHydrogen(true) < 1.0f)
             {
                 hydrogen -= transferSpeed;
                 currentPlanet.AddElement(transferSpeed, 0, 0, 0);
                 if (!hydrogenParticles.isPlaying)
                 {
                     hydrogenParticles.Play();
                 }
             }
             else
             {
                 hydrogenParticles.Stop();
             }
         }
         else
         {
             hydrogenParticles.Stop();
         }
         if (oxygenButton.IsClicked())
         {
             if (oxygen > 0 && currentPlanet.GetOxygen(true) < 1.0f)
             {
                 oxygen -= transferSpeed;
                 currentPlanet.AddElement(0, transferSpeed, 0, 0);
                 if (!oxygenParticles.isPlaying)
                 {
                     oxygenParticles.Play();
                 }
             }
             else
             {
                 oxygenParticles.Stop();
             }
         }
         else
         {
             oxygenParticles.Stop();
         }
         if (nitrogenButton.IsClicked())
         {
             if (nitrogen > 0 && currentPlanet.GetNitrogen(true) < 1.0f)
             {
                 nitrogen -= transferSpeed;
                 currentPlanet.AddElement(0, 0, transferSpeed, 0);
                 if (!nitrogenParticles.isPlaying)
                 {
                     nitrogenParticles.Play();
                 }
             }
             else
             {
                 nitrogenParticles.Stop();
             }
         }
         else
         {
             nitrogenParticles.Stop();
         }
         if (carbonButton.IsClicked())
         {
             if (carbon > 0 && currentPlanet.GetCarbon(true) < 1.0f)
             {
                 carbon -= transferSpeed;
                 currentPlanet.AddElement(0, 0, 0, transferSpeed);
                 if (!carbonParticles.isPlaying)
                 {
                     carbonParticles.Play();
                 }
             }
             else
             {
                 carbonParticles.Stop();
             }
         }
         else
         {
             carbonParticles.Stop();
         }
     }
 }