lightened shadow; added rotor shadows to heli; stripped some duplication; still a lot left though
This commit is contained in:
@@ -22,7 +22,7 @@ namespace OpenRa.Game.Graphics
|
||||
foreach (string remap in new string[] { "blue", "red", "orange", "teal", "salmon", "green", "gray" })
|
||||
AddPalette(new Palette(pal, new PaletteRemap(FileSystem.Open(remap + ".rem"))));
|
||||
|
||||
AddPalette(new Palette(pal, new PaletteRemap(Color.FromArgb(178, 0, 0, 0))));
|
||||
AddPalette(new Palette(pal, new PaletteRemap(Color.FromArgb(140, 0, 0, 0))));
|
||||
|
||||
using (var bitmapCopy = new Bitmap(bitmap))
|
||||
for (int j = 0; j < maxEntries; j++)
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace OpenRa.Game
|
||||
Game.world.Add(new Actor("ca", Game.map.Offset + new int2(40, 7), Game.players[1]));
|
||||
Game.world.Add(new Actor("e1", Game.map.Offset + new int2(9, 13), Game.players[1]));
|
||||
Game.world.Add(new Actor("arty", Game.map.Offset + new int2(10, 13), Game.players[1]));
|
||||
Game.world.Add(new Actor("v2rl", Game.map.Offset + new int2(11, 12), Game.players[1]));
|
||||
Game.world.Add(new Actor("heli", Game.map.Offset + new int2(11, 12), Game.players[1]));
|
||||
|
||||
renderer.BuildPalette(Game.map);
|
||||
sidebar = new Sidebar(renderer, Game.LocalPlayer);
|
||||
|
||||
@@ -27,14 +27,27 @@ namespace OpenRa.Game.Traits
|
||||
{
|
||||
var mobile = self.traits.Get<Mobile>();
|
||||
|
||||
yield return Util.Centered(self, anim.Image, self.CenterLocation);
|
||||
yield return Util.Centered(self, rotorAnim.Image, self.CenterLocation
|
||||
yield return Util.CenteredShadow(self, anim.Image, self.CenterLocation);
|
||||
yield return Util.CenteredShadow(self, rotorAnim.Image, self.CenterLocation
|
||||
+ Util.GetTurretPosition(self, self.unitInfo.PrimaryOffset, 0));
|
||||
if (self.unitInfo.SecondaryOffset != null)
|
||||
yield return Util.Centered(self, (secondRotorAnim ?? rotorAnim).Image, self.CenterLocation
|
||||
yield return Util.CenteredShadow(self, (secondRotorAnim ?? rotorAnim).Image, self.CenterLocation
|
||||
+ Util.GetTurretPosition(self, self.unitInfo.SecondaryOffset, 0));
|
||||
|
||||
var p = self.CenterLocation - new float2( 0, altitude );
|
||||
|
||||
yield return Util.Centered(self, anim.Image, p);
|
||||
yield return Util.Centered(self, rotorAnim.Image, p
|
||||
+ Util.GetTurretPosition(self, self.unitInfo.PrimaryOffset, 0));
|
||||
if (self.unitInfo.SecondaryOffset != null)
|
||||
yield return Util.Centered(self, (secondRotorAnim ?? rotorAnim).Image, p
|
||||
+ Util.GetTurretPosition(self, self.unitInfo.SecondaryOffset, 0));
|
||||
}
|
||||
|
||||
int altitude = 0;
|
||||
const int climbRate = 1;
|
||||
const int cruiseAltitude = 20;
|
||||
|
||||
public override void Tick(Actor self)
|
||||
{
|
||||
base.Tick(self);
|
||||
@@ -44,12 +57,18 @@ namespace OpenRa.Game.Traits
|
||||
|
||||
var mobile = self.traits.Get<Mobile>();
|
||||
var isFlying = mobile.HasActivity;
|
||||
if (isFlying ^ (rotorAnim.CurrentSequence.Name != "rotor"))
|
||||
|
||||
if (isFlying && altitude < cruiseAltitude)
|
||||
altitude = Math.Min(altitude + climbRate, cruiseAltitude);
|
||||
else if (!isFlying && altitude > 0)
|
||||
altitude = Math.Max(altitude - climbRate, 0);
|
||||
|
||||
if ((altitude >0) ^ (rotorAnim.CurrentSequence.Name != "rotor"))
|
||||
return;
|
||||
|
||||
rotorAnim.PlayRepeatingPreservingPosition(isFlying ? "rotor" : "slow-rotor");
|
||||
rotorAnim.PlayRepeatingPreservingPosition((altitude>0) ? "rotor" : "slow-rotor");
|
||||
if (secondRotorAnim != null)
|
||||
secondRotorAnim.PlayRepeatingPreservingPosition(isFlying ? "rotor2" : "slow-rotor2");
|
||||
secondRotorAnim.PlayRepeatingPreservingPosition((altitude>0) ? "rotor2" : "slow-rotor2");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,5 +104,10 @@ namespace OpenRa.Game.Traits
|
||||
return Tuple.New(s, loc.Round(), self.Owner.Palette);
|
||||
}
|
||||
|
||||
public static Tuple<Sprite, float2, int> CenteredShadow(Actor self, Sprite s, float2 location)
|
||||
{
|
||||
var loc = location - 0.5f * s.size;
|
||||
return Tuple.New(s, loc.Round(), 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user