private void PlayFootstepSound(float vol, float biomo, bool water) { if (localPlanetId < 0) { // wait for update that should happen soon // its updated by localPlanetSyncProcessor.cs return; } AmbientDesc ambientDesc = GameMain.galaxy.PlanetById(localPlanetId).ambientDesc; string audioName = string.Empty; try { if (!water) { if ((double)biomo <= 0.8) { name = solidSoundEvents[ambientDesc.biomoSound0]; } else if ((double)biomo <= 1.8) { name = solidSoundEvents[ambientDesc.biomoSound1]; } else { name = solidSoundEvents[ambientDesc.biomoSound2]; } if (CheckPlayerInReform()) { name = solidSoundEvents[3]; } } else { name = waterSoundEvent; } } catch { name = string.Empty; } VFAudio audio = VFAudio.Create(name, base.transform, Vector3.zero, false, 0); audio.volumeMultiplier = vol; audio.Play(); }
private void PlayFootstepEffect(bool lr, float biomo, bool water) { if (CheckPlayerInReform() || localPlanetId < 0) { return; } ParticleSystem waterParticle = (!lr) ? WaterEffect[0] : WaterEffect[1]; ParticleSystem[] smokeParticle = (!lr) ? FootSmokeEffect[0] : FootSmokeEffect[1]; ParticleSystem footEffect = (!lr) ? FootEffect[0] : FootEffect[1]; AmbientDesc ambientDesc = GameMain.galaxy.PlanetById(localPlanetId).ambientDesc; Color color = Color.clear; float dustStrength = 1f; if (!water) { if (biomo <= 0f) { color = ambientDesc.biomoDustColor0; dustStrength = ambientDesc.biomoDustStrength0; } else if (biomo <= 1f) { color = Color.Lerp(ambientDesc.biomoDustColor0, ambientDesc.biomoColor1, biomo); dustStrength = Mathf.Lerp(ambientDesc.biomoDustStrength0, ambientDesc.biomoDustStrength1, biomo); } else if (biomo <= 2f) { color = Color.Lerp(ambientDesc.biomoDustColor1, ambientDesc.biomoColor2, biomo - 1f); dustStrength = Mathf.Lerp(ambientDesc.biomoDustStrength1, ambientDesc.biomoDustStrength2, biomo - 1f); } else { color = ambientDesc.biomoDustColor2; dustStrength = ambientDesc.biomoDustStrength2; } } if (biomo >= 0f || water) { ParticleSystem.MainModule main = waterParticle.main; main.startColor = ((!water) ? Color.clear : Color.white); foreach (ParticleSystem p in smokeParticle) { main = p.main; main.startColor = color; } foreach (ParticleSystem p in FootSmallSmoke) { main = p.main; main.startLifetime = 0.8f + 0.2f * dustStrength; main.startSize = 1.1f + 0.2f * dustStrength; } foreach (ParticleSystem p in FootLargeSmoke) { main = p.main; main.startLifetime = 1.2f * dustStrength; main.startSize = 2.2f + 2.4f * dustStrength; } footEffect.Play(); } }