Add EnemyWatcher trait to D2k and AnnounceOnSeen to D2k units and sandworms; remove sandworm announcement on worm spawn

This commit is contained in:
penev92
2015-01-13 17:10:06 +02:00
parent e2832bb3d7
commit a4a8a793df
4 changed files with 13 additions and 18 deletions

View File

@@ -43,7 +43,6 @@ namespace OpenRA.Mods.D2k.Traits
{
readonly WormManagerInfo info;
readonly Lazy<Actor[]> spawnPointActors;
readonly Lazy<RadarPings> radarPings;
int spawnCountdown;
int wormsPresent;
@@ -51,7 +50,6 @@ namespace OpenRA.Mods.D2k.Traits
public WormManager(Actor self, WormManagerInfo info)
{
this.info = info;
radarPings = Exts.Lazy(() => self.World.WorldActor.Trait<RadarPings>());
spawnPointActors = Exts.Lazy(() => self.World.ActorsWithTrait<WormSpawner>().Select(x => x.Actor).ToArray());
}
@@ -80,8 +78,6 @@ namespace OpenRA.Mods.D2k.Traits
// more we need to reach the defined minimum count.
wormLocations.Add(SpawnWorm(self));
} while (wormsPresent < info.Minimum);
AnnounceWormSign(self, wormLocations);
}
WPos SpawnWorm(Actor self)
@@ -107,17 +103,5 @@ namespace OpenRA.Mods.D2k.Traits
{
wormsPresent--;
}
void AnnounceWormSign(Actor self, IEnumerable<WPos> wormLocations)
{
if (self.World.LocalPlayer != null)
Sound.PlayNotification(self.World.Map.Rules, self.World.LocalPlayer, "Speech", info.WormSignNotification, self.World.LocalPlayer.Country.Race);
if (radarPings.Value == null)
return;
foreach (var wormLocation in wormLocations)
radarPings.Value.Add(() => true, wormLocation, Color.Red, 50);
}
}
}