private void GamePaused(bool paused) { if (paused) { StopCoroutine("DoFire"); fireData.CalcuateNewDuration(); } else { StartCoroutine("DoFire"); } }
// disable the script if paused to stop the objects from moving private void GamePaused(bool paused) { ParticleSystem particleSystem = null; PowerUpTypes activePowerUp = powerUpManager.GetActivePowerUp(); if (activePowerUp != PowerUpTypes.None) { particleSystem = powerUpParticleSystem[(int)activePowerUp]; } if (paused) { if (coinCollectionParticleSystem.isPlaying) { pauseCoinParticlePlaying = true; coinCollectionParticleSystem.Pause(); } if (secondaryCoinCollectionParticleSystem != null && secondaryCoinCollectionParticleSystem.isPlaying) { pauseSecondaryCoinParticlePlaying = true; secondaryCoinCollectionParticleSystem.Pause(); } if (collisionParticleSystem.isPlaying) { pauseCollisionParticlePlaying = true; collisionParticleSystem.Pause(); } if (groundCollisionParticleSystem.isPlaying) { pauseGroundParticlePlaying = true; groundCollisionParticleSystem.Pause(); } if (particleSystem != null) { particleSystem.Pause(); } } else { if (pauseCoinParticlePlaying) { coinCollectionParticleSystem.Play(); pauseCoinParticlePlaying = false; } if (pauseSecondaryCoinParticlePlaying) { secondaryCoinCollectionParticleSystem.Play(); pauseSecondaryCoinParticlePlaying = false; } if (pauseCollisionParticlePlaying) { collisionParticleSystem.Play(); pauseCollisionParticlePlaying = false; } if (pauseGroundParticlePlaying) { groundCollisionParticleSystem.Play(); pauseGroundParticlePlaying = false; } if (particleSystem != null) { particleSystem.Play(); } } if (isSliding) { if (paused) { StopCoroutine("DoSlide"); slideData.CalcuateNewDuration(); } else { StartCoroutine("DoSlide"); } } if (isStumbling) { if (paused) { StopCoroutine("Stumble"); stumbleData.CalcuateNewDuration(); } else { StartCoroutine("Stumble"); } } enabled = !paused; }