Blinky lights
This commit is contained in:
@@ -79,6 +79,7 @@ namespace OpenRa.Game
|
||||
|
||||
var worldActor = new Actor(null, new int2(int.MaxValue, int.MaxValue), null);
|
||||
worldActor.traits.Add(new Traits.WaterPaletteRotation(worldActor));
|
||||
worldActor.traits.Add(new Traits.LightPaletteRotator(worldActor));
|
||||
worldActor.traits.Add(new Traits.ChronoshiftPaletteEffect(worldActor));
|
||||
Game.world.Add(worldActor);
|
||||
|
||||
|
||||
@@ -234,6 +234,7 @@
|
||||
<Compile Include="Traits\ConstructionYard.cs" />
|
||||
<Compile Include="Traits\IronCurtain.cs" />
|
||||
<Compile Include="Traits\IronCurtainable.cs" />
|
||||
<Compile Include="Traits\LightPaletteRotator.cs" />
|
||||
<Compile Include="Traits\MineImmune.cs" />
|
||||
<Compile Include="Traits\Minelayer.cs" />
|
||||
<Compile Include="Traits\LimitedAmmo.cs" />
|
||||
|
||||
26
OpenRa.Game/Traits/LightPaletteRotator.cs
Normal file
26
OpenRa.Game/Traits/LightPaletteRotator.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System.Drawing;
|
||||
|
||||
namespace OpenRa.Game.Traits
|
||||
{
|
||||
class LightPaletteRotator : ITick, IPaletteModifier
|
||||
{
|
||||
public LightPaletteRotator(Actor self) { }
|
||||
|
||||
float t = 0;
|
||||
public void Tick(Actor self)
|
||||
{
|
||||
t += .5f;
|
||||
}
|
||||
|
||||
public void AdjustPalette(Bitmap b)
|
||||
{
|
||||
var rotate = (int)t % 18;
|
||||
if (rotate > 9)
|
||||
rotate = 18 - rotate;
|
||||
|
||||
using (var bitmapCopy = new Bitmap(b))
|
||||
for (int j = 0; j < 16; j++)
|
||||
b.SetPixel(0x67, j, b.GetPixel(230+rotate, j));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user