Tidy HiddenUnderFog.

This commit is contained in:
Paul Chote
2013-07-24 21:17:23 +12:00
parent 7405921621
commit 67388d2ba9

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2013 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, 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. For more information,
@@ -15,19 +15,18 @@ using OpenRA.Traits;
namespace OpenRA.Mods.RA
{
class HiddenUnderFogInfo : TraitInfo<HiddenUnderFog> {}
public class HiddenUnderFogInfo : TraitInfo<HiddenUnderFog> { }
class HiddenUnderFog : IRenderModifier, IVisibilityModifier
public class HiddenUnderFog : IRenderModifier, IVisibilityModifier
{
public bool IsVisible(Actor self, Player byPlayer)
{
return byPlayer == null || Shroud.GetVisOrigins(self).Any(o => byPlayer.Shroud.IsVisible(o));
}
static IRenderable[] Nothing = { };
public IEnumerable<IRenderable> ModifyRender(Actor self, WorldRenderer wr, IEnumerable<IRenderable> r)
{
return IsVisible(self, self.World.RenderPlayer) ? r : Nothing;
return IsVisible(self, self.World.RenderPlayer) ? r : SpriteRenderable.None;
}
}
}