ActorInitializer, in preparation for next change (bob)

This commit is contained in:
Chris Forbes
2010-06-19 14:28:30 +12:00
parent 572cdc9dbf
commit db465e1fdd
106 changed files with 174 additions and 227 deletions

View File

@@ -32,18 +32,19 @@ namespace OpenRA.Mods.RA
public readonly int G = 0;
public readonly int B = 0;
public readonly int A = 255;
public object Create(Actor self) { return new PaletteFromRGBA(self, this); }
public object Create(ActorInitializer init) { return new PaletteFromRGBA(init.world, this); }
}
class PaletteFromRGBA
{
public PaletteFromRGBA(Actor self, PaletteFromRGBAInfo info)
public PaletteFromRGBA(World world, PaletteFromRGBAInfo info)
{
if (info.Theatre == null ||
info.Theatre.ToLowerInvariant() == self.World.Map.Theater.ToLowerInvariant())
info.Theatre.ToLowerInvariant() == world.Map.Theater.ToLowerInvariant())
{
// TODO: This shouldn't rely on a base palette
var wr = self.World.WorldRenderer;
var wr = world.WorldRenderer;
var pal = wr.GetPalette("player0");
wr.AddPalette(info.Name, new Palette(pal, new SingleColorRemap(Color.FromArgb(info.A, info.R, info.G, info.B))));
}