Cleaned up IVoiced-related code.

Added Volume control and descriptions to Voiced.

Streamline voice checks in WorldUtils and DeathSounds.
This commit is contained in:
reaperrr
2015-05-14 17:48:35 +02:00
parent 251d3e6864
commit 5f68516070
8 changed files with 57 additions and 73 deletions

View File

@@ -57,10 +57,10 @@ namespace OpenRA
}
}
var voicedActor = actors.FirstOrDefault(a => a.Owner == world.LocalPlayer && a.IsInWorld && (a.TraitsImplementing<IVoiced>() != null));
var voicedActor = actors.FirstOrDefault(a => a.Owner == world.LocalPlayer && a.IsInWorld && a.HasTrait<IVoiced>());
if (voicedActor != null)
foreach (var voice in voicedActor.TraitsImplementing<IVoiced>())
voice.PlayVoice("Select", voicedActor, voicedActor.Owner.Country.Race);
voice.PlayVoice(voicedActor, "Select", voicedActor.Owner.Country.Race);
foreach (var a in newSelection)
foreach (var sel in a.TraitsImplementing<INotifySelected>())