make unit smoke optional
This commit is contained in:
@@ -16,6 +16,7 @@ namespace OpenRA.Mods.RA.Render
|
|||||||
{
|
{
|
||||||
public class RenderUnitInfo : RenderSimpleInfo
|
public class RenderUnitInfo : RenderSimpleInfo
|
||||||
{
|
{
|
||||||
|
public readonly bool Smokes = true;
|
||||||
public override object Create(ActorInitializer init) { return new RenderUnit(init.self); }
|
public override object Create(ActorInitializer init) { return new RenderUnit(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -24,7 +25,11 @@ namespace OpenRA.Mods.RA.Render
|
|||||||
public RenderUnit(Actor self)
|
public RenderUnit(Actor self)
|
||||||
: base(self, () => self.HasTrait<IFacing>() ? self.Trait<IFacing>().Facing : 0)
|
: base(self, () => self.HasTrait<IFacing>() ? self.Trait<IFacing>().Facing : 0)
|
||||||
{
|
{
|
||||||
|
canSmoke = self.Info.Traits.Get<RenderUnitInfo>().Smokes;
|
||||||
|
|
||||||
anim.Play("idle");
|
anim.Play("idle");
|
||||||
|
|
||||||
|
if (canSmoke)
|
||||||
anims.Add( "smoke", new AnimationWithOffset( new Animation( "smoke_m" ), null, () => !isSmoking ) );
|
anims.Add( "smoke", new AnimationWithOffset( new Animation( "smoke_m" ), null, () => !isSmoking ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,11 +39,12 @@ namespace OpenRA.Mods.RA.Render
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool isSmoking;
|
bool isSmoking;
|
||||||
|
bool canSmoke;
|
||||||
|
|
||||||
public void Damaged(Actor self, AttackInfo e)
|
public void Damaged(Actor self, AttackInfo e)
|
||||||
{
|
{
|
||||||
if (e.DamageState < DamageState.Heavy) return;
|
if (e.DamageState < DamageState.Heavy) return;
|
||||||
if (isSmoking) return;
|
if (isSmoking || !canSmoke) return;
|
||||||
|
|
||||||
isSmoking = true;
|
isSmoking = true;
|
||||||
var smoke = anims[ "smoke" ].Animation;
|
var smoke = anims[ "smoke" ].Animation;
|
||||||
|
|||||||
Reference in New Issue
Block a user