Merge pull request #10568 from abcdefg30/waterCrates

Fix crates not showing their water animation
This commit is contained in:
Matthias Mailänder
2016-01-23 15:10:26 +01:00

View File

@@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Traits
}
}
class WithCrateBody : INotifyParachuteLanded
class WithCrateBody : INotifyParachuteLanded, INotifyAddedToWorld
{
readonly Actor self;
readonly Animation anim;
@@ -57,7 +57,21 @@ namespace OpenRA.Mods.Common.Traits
rs.Add(anim);
}
public void OnLanded()
void INotifyAddedToWorld.AddedToWorld(Actor self)
{
// Don't change animations while still in air
if (!self.IsAtGroundLevel())
return;
PlaySequence();
}
void INotifyParachuteLanded.OnLanded()
{
PlaySequence();
}
void PlaySequence()
{
var sequence = self.World.Map.GetTerrainInfo(self.Location).IsWater ? info.WaterSequence : info.LandSequence;
if (!string.IsNullOrEmpty(sequence))