-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+Transport sfx +Casing added to HMMV,JEEP,BGGY,IFV +Add Heli/Jet SFX
- Loading branch information
Showing
23 changed files
with
238 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#region Copyright & License Information | ||
/* | ||
* Copyright (c) The CA Developers and Contributors | ||
* This file is part of CA, which is free software. It is made | ||
* available to you under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation, either version 3 of | ||
* the License, or (at your option) any later version. For more | ||
* information, see COPYING. | ||
*/ | ||
#endregion | ||
|
||
using System; | ||
using OpenRA.Mods.Common.Traits; | ||
using OpenRA.Primitives; | ||
using OpenRA.Traits; | ||
|
||
namespace OpenRA.Mods.CA.Traits.Sound | ||
{ | ||
public class SoundOnDamageTransitionCAInfo : ConditionalTraitInfo | ||
{ | ||
[Desc("Play a random sound from this list when damaged.")] | ||
public readonly string[] DamagedSounds = Array.Empty<string>(); | ||
|
||
[Desc("Play a random sound from this list when destroyed.")] | ||
public readonly string[] DestroyedSounds = Array.Empty<string>(); | ||
|
||
[Desc("DamageType(s) that trigger the sounds. Leave empty to always trigger a sound.")] | ||
public readonly BitSet<DamageType> DamageTypes = default; | ||
|
||
public override object Create(ActorInitializer init) { return new SoundOnDamageTransitionCA(init.Self, this); } | ||
} | ||
|
||
public class SoundOnDamageTransitionCA : ConditionalTrait<SoundOnDamageTransitionCAInfo>, INotifyDamageStateChanged | ||
{ | ||
public SoundOnDamageTransitionCA(Actor self, SoundOnDamageTransitionCAInfo info) | ||
: base(info) { } | ||
|
||
void INotifyDamageStateChanged.DamageStateChanged(Actor self, AttackInfo e) | ||
{ | ||
if (IsTraitDisabled) | ||
return; | ||
|
||
if (!Info.DamageTypes.IsEmpty && !e.Damage.DamageTypes.Overlaps(Info.DamageTypes)) | ||
return; | ||
|
||
var rand = Game.CosmeticRandom; | ||
|
||
if (e.DamageState == DamageState.Dead) | ||
{ | ||
var sound = Info.DestroyedSounds.RandomOrDefault(rand); | ||
Game.Sound.Play(SoundType.World, sound, self.CenterPosition); | ||
} | ||
else if (e.DamageState >= DamageState.Heavy && e.PreviousDamageState < DamageState.Heavy) | ||
{ | ||
var sound = Info.DamagedSounds.RandomOrDefault(rand); | ||
Game.Sound.Play(SoundType.World, sound, self.CenterPosition); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.