fix units being visible under fog

This commit is contained in:
Chris Forbes
2010-04-02 17:09:20 +13:00
parent ca0d993c1a
commit 37fd8f7c28
6 changed files with 44 additions and 16 deletions

View File

@@ -30,17 +30,13 @@ namespace OpenRA.Traits
public override object Create(Actor self) { return new RenderUnit(self); }
}
class RenderUnit : RenderSimple, INotifyDamage, IRenderModifier
class RenderUnit : RenderSimple, INotifyDamage
{
Shroud shroud;
public RenderUnit(Actor self)
: base(self, () => self.traits.Get<Unit>().Facing)
{
anim.Play("idle");
anims.Add( "smoke", new AnimationWithOffset( new Animation( "smoke_m" ), null, () => !isSmoking ) );
shroud = self.World.WorldActor.traits.Get<Shroud>();
}
public void PlayCustomAnimation(Actor self, string newAnim, Action after)
@@ -62,14 +58,5 @@ namespace OpenRA.Traits
() => smoke.PlayBackwardsThen( "end",
() => isSmoking = false ) ) );
}
public IEnumerable<Renderable> ModifyRender(Actor self, IEnumerable<Renderable> r)
{
if (self.Owner == self.World.LocalPlayer ||
shroud.visibleCells[self.Location.X, self.Location.Y] > 0)
return r;
return new Renderable[] { };
}
}
}