Add sandworm attack sound

This commit is contained in:
penev92
2015-04-24 18:17:44 +03:00
parent 3bd4a97d11
commit 76a3b9c3b7
4 changed files with 17 additions and 15 deletions

View File

@@ -8,6 +8,7 @@
*/
#endregion
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.Activities;
@@ -89,21 +90,28 @@ namespace OpenRA.Mods.D2k.Activities
}
positionable.SetPosition(worm, targetLocation);
foreach (var notify in worm.TraitsImplementing<INotifyAttack>())
notify.Attacking(worm, target, null, null);
PlayAttackAnimation(worm);
var attackPosition = worm.CenterPosition;
var affectedPlayers = lunch.Select(x => x.Owner).Distinct();
foreach (var affectedPlayer in affectedPlayers)
NotifyPlayer(affectedPlayer, attackPosition);
var affectedPlayers = lunch.Select(x => x.Owner).Distinct().ToList();
PlayAttack(worm, attackPosition, affectedPlayers);
foreach (var notify in worm.TraitsImplementing<INotifyAttack>())
notify.Attacking(worm, target, null, null);
return true;
}
void PlayAttackAnimation(Actor self)
// List because IEnumerable gets evaluated too late.
void PlayAttack(Actor self, WPos attackPosition, List<Player> affectedPlayers)
{
renderUnit.PlayCustomAnim(self, "mouth");
Sound.Play(swallow.Info.WormAttackSound, self.CenterPosition);
Game.RunAfterDelay(1000, () =>
{
foreach (var affectedPlayer in affectedPlayers)
NotifyPlayer(affectedPlayer, attackPosition);
});
}
void NotifyPlayer(Player player, WPos location)

View File

@@ -23,6 +23,7 @@ namespace OpenRA.Mods.D2k.Traits
[Desc("The number of ticks it takes to get in place under the target to attack.")]
public readonly int AttackTime = 30;
public readonly string WormAttackSound = "Worm.wav";
public readonly string WormAttackNotification = "WormAttack";
public override object Create(ActorInitializer init) { return new AttackSwallow(init.Self, this); }

View File

@@ -99,10 +99,4 @@ SaboteurVoice:
Die: KILLGUY1,KILLGUY2,KILLGUY3,KILLGUY4,KILLGUY5,KILLGUY6,KILLGUY7,KILLGUY8,KILLGUY9
Guard: I_GUARD
DisablePrefixes: Select, Move, Die
DisableVariants: Select, Move, Guard
WormVoice:
DefaultVariant: .WAV
Voices:
Select: WRMSIGN1
Move: WORM
DisableVariants: Select, Move, Guard

View File

@@ -506,7 +506,6 @@ Heal:
WormJaw:
ReloadDelay: 10
Range: 3c0
Report: WORM.WAV
Warhead@1Dam: SpreadDamage
Spread: 160
Damage: 100