public void UpdateSoundPosition() { if (VoipSound == null) { return; } if (!VoipSound.IsPlaying) { DebugConsole.Log("Destroying voipsound"); VoipSound.Dispose(); VoipSound = null; return; } if (character != null) { if (GameMain.Config.UseDirectionalVoiceChat) { VoipSound.SetPosition(new Vector3(character.WorldPosition.X, character.WorldPosition.Y, 0.0f)); } else { VoipSound.SetPosition(null); float dist = Vector3.Distance(new Vector3(character.WorldPosition, 0.0f), GameMain.SoundManager.ListenerPosition); VoipSound.Gain = 1.0f - MathUtils.InverseLerp(VoipSound.Near, VoipSound.Far, dist); } } else { VoipSound.SetPosition(null); } }
public void UpdateSoundPosition() { if (VoipSound != null) { if (!VoipSound.IsPlaying) { DebugConsole.Log("Destroying voipsound"); VoipSound.Dispose(); VoipSound = null; return; } if (character != null) { VoipSound.SetPosition(new Vector3(character.WorldPosition.X, character.WorldPosition.Y, 0.0f)); } else { VoipSound.SetPosition(null); } } }