Add sandworm attack sound
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Activities;
|
using OpenRA.Activities;
|
||||||
@@ -89,21 +90,28 @@ namespace OpenRA.Mods.D2k.Activities
|
|||||||
}
|
}
|
||||||
|
|
||||||
positionable.SetPosition(worm, targetLocation);
|
positionable.SetPosition(worm, targetLocation);
|
||||||
foreach (var notify in worm.TraitsImplementing<INotifyAttack>())
|
|
||||||
notify.Attacking(worm, target, null, null);
|
|
||||||
PlayAttackAnimation(worm);
|
|
||||||
|
|
||||||
var attackPosition = worm.CenterPosition;
|
var attackPosition = worm.CenterPosition;
|
||||||
var affectedPlayers = lunch.Select(x => x.Owner).Distinct();
|
var affectedPlayers = lunch.Select(x => x.Owner).Distinct().ToList();
|
||||||
foreach (var affectedPlayer in affectedPlayers)
|
|
||||||
NotifyPlayer(affectedPlayer, attackPosition);
|
PlayAttack(worm, attackPosition, affectedPlayers);
|
||||||
|
foreach (var notify in worm.TraitsImplementing<INotifyAttack>())
|
||||||
|
notify.Attacking(worm, target, null, null);
|
||||||
|
|
||||||
return true;
|
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");
|
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)
|
void NotifyPlayer(Player player, WPos location)
|
||||||
|
|||||||
@@ -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.")]
|
[Desc("The number of ticks it takes to get in place under the target to attack.")]
|
||||||
public readonly int AttackTime = 30;
|
public readonly int AttackTime = 30;
|
||||||
|
|
||||||
|
public readonly string WormAttackSound = "Worm.wav";
|
||||||
public readonly string WormAttackNotification = "WormAttack";
|
public readonly string WormAttackNotification = "WormAttack";
|
||||||
|
|
||||||
public override object Create(ActorInitializer init) { return new AttackSwallow(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new AttackSwallow(init.Self, this); }
|
||||||
|
|||||||
@@ -99,10 +99,4 @@ SaboteurVoice:
|
|||||||
Die: KILLGUY1,KILLGUY2,KILLGUY3,KILLGUY4,KILLGUY5,KILLGUY6,KILLGUY7,KILLGUY8,KILLGUY9
|
Die: KILLGUY1,KILLGUY2,KILLGUY3,KILLGUY4,KILLGUY5,KILLGUY6,KILLGUY7,KILLGUY8,KILLGUY9
|
||||||
Guard: I_GUARD
|
Guard: I_GUARD
|
||||||
DisablePrefixes: Select, Move, Die
|
DisablePrefixes: Select, Move, Die
|
||||||
DisableVariants: Select, Move, Guard
|
DisableVariants: Select, Move, Guard
|
||||||
|
|
||||||
WormVoice:
|
|
||||||
DefaultVariant: .WAV
|
|
||||||
Voices:
|
|
||||||
Select: WRMSIGN1
|
|
||||||
Move: WORM
|
|
||||||
@@ -506,7 +506,6 @@ Heal:
|
|||||||
WormJaw:
|
WormJaw:
|
||||||
ReloadDelay: 10
|
ReloadDelay: 10
|
||||||
Range: 3c0
|
Range: 3c0
|
||||||
Report: WORM.WAV
|
|
||||||
Warhead@1Dam: SpreadDamage
|
Warhead@1Dam: SpreadDamage
|
||||||
Spread: 160
|
Spread: 160
|
||||||
Damage: 100
|
Damage: 100
|
||||||
|
|||||||
Reference in New Issue
Block a user