Cleaned up IVoiced-related code.
Added Volume control and descriptions to Voiced. Streamline voice checks in WorldUtils and DeathSounds.
This commit is contained in:
@@ -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>())
|
||||
|
||||
@@ -111,11 +111,10 @@ namespace OpenRA.Traits
|
||||
|
||||
public interface IVoiced
|
||||
{
|
||||
bool PlayVoice(string phrase, Actor voicedActor, string variant);
|
||||
bool PlayVoiceLocal(string phrase, Actor voicedActor, string variant, WPos pos, float volume);
|
||||
bool HasVoices(Actor actor);
|
||||
bool HasVoice(Actor actor, string voice);
|
||||
string VoiceSet { get; }
|
||||
bool PlayVoice(Actor self, string phrase, string variant);
|
||||
bool PlayVoiceLocal(Actor self, string phrase, string variant, float volume);
|
||||
bool HasVoice(Actor self, string voice);
|
||||
}
|
||||
|
||||
public interface IDemolishableInfo { bool IsValidTarget(ActorInfo actorInfo, Actor saboteur); }
|
||||
|
||||
@@ -50,17 +50,14 @@ namespace OpenRA
|
||||
if (o == null)
|
||||
continue;
|
||||
|
||||
if (o.Subject.Destroyed)
|
||||
var orderSubject = o.Subject;
|
||||
if (orderSubject.Destroyed)
|
||||
continue;
|
||||
|
||||
var hasVoice = o.Subject.TraitsImplementing<IVoiced>();
|
||||
if (hasVoice == null)
|
||||
continue;
|
||||
|
||||
foreach (var v in o.Subject.TraitsImplementing<IOrderVoice>())
|
||||
foreach (var voice in o.Subject.TraitsImplementing<IVoiced>())
|
||||
if (voice.PlayVoice(v.VoicePhraseForOrder(o.Subject, o),
|
||||
o.Subject, o.Subject.Owner.Country.Race))
|
||||
foreach (var voice in orderSubject.TraitsImplementing<IVoiced>())
|
||||
foreach (var v in orderSubject.TraitsImplementing<IOrderVoice>())
|
||||
if (voice.PlayVoice(orderSubject, v.VoicePhraseForOrder(orderSubject, o),
|
||||
orderSubject.Owner.Country.Race))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user