Add DeathTypes to ShakeOnDeath.
This commit is contained in:
committed by
Paul Chote
parent
1a4b773fda
commit
761d3583c4
@@ -9,12 +9,16 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using OpenRA.Primitives;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
public class ShakeOnDeathInfo : TraitInfo
|
public class ShakeOnDeathInfo : TraitInfo
|
||||||
{
|
{
|
||||||
|
[Desc("DeathType(s) that trigger the shake. Leave empty to always trigger a shake.")]
|
||||||
|
public readonly BitSet<DamageType> DeathTypes = default(BitSet<DamageType>);
|
||||||
|
|
||||||
public readonly int Duration = 10;
|
public readonly int Duration = 10;
|
||||||
public readonly int Intensity = 1;
|
public readonly int Intensity = 1;
|
||||||
public override object Create(ActorInitializer init) { return new ShakeOnDeath(this); }
|
public override object Create(ActorInitializer init) { return new ShakeOnDeath(this); }
|
||||||
@@ -31,6 +35,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
void INotifyKilled.Killed(Actor self, AttackInfo e)
|
void INotifyKilled.Killed(Actor self, AttackInfo e)
|
||||||
{
|
{
|
||||||
|
if (!info.DeathTypes.IsEmpty && !e.Damage.DamageTypes.Overlaps(info.DeathTypes))
|
||||||
|
return;
|
||||||
|
|
||||||
self.World.WorldActor.Trait<ScreenShaker>().AddEffect(info.Duration, self.CenterPosition, info.Intensity);
|
self.World.WorldActor.Trait<ScreenShaker>().AddEffect(info.Duration, self.CenterPosition, info.Intensity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user