This commit is contained in:
Chris Forbes
2010-01-11 19:29:45 +13:00
parent bd6f22c57e
commit e7a99541e5
7 changed files with 11 additions and 12 deletions

View File

@@ -169,7 +169,7 @@ namespace OpenRa.Game.Graphics
lineRenderer.DrawLine(xy + new float2(0, -2), xy + new float2(0, -4), c, c);
lineRenderer.DrawLine(Xy + new float2(0, -2), Xy + new float2(0, -4), c, c);
var healthAmount = (float)selectedUnit.Health / selectedUnit.LegacyInfo.Strength;
var healthAmount = (float)selectedUnit.Health / selectedUnit.Info.Traits.WithInterface<OwnedActorInfo>().First().HP;
var healthColor = (healthAmount < Rules.General.ConditionRed) ? Color.Red
: (healthAmount < Rules.General.ConditionYellow) ? Color.Yellow
: Color.LimeGreen;

View File

@@ -27,9 +27,7 @@ namespace OpenRa.Game.Orders
&& a.traits.Contains<Building>()
&& a.traits.Contains<Selectable>()).FirstOrDefault();
var building = underCursor != null ? underCursor.LegacyInfo as LegacyBuildingInfo : null;
if (building != null)
if (underCursor != null)
yield return new Order("PowerDown", underCursor, null, int2.Zero, null);
}
}

View File

@@ -30,11 +30,11 @@ namespace OpenRa.Game.Traits.Activities
return this;
}
var range = Rules.WeaponInfo[ self.LegacyInfo.Primary ].Range - 1;
var range = Rules.WeaponInfo[ self.Info.Traits.WithInterface<AttackBaseInfo>().First().PrimaryWeapon ].Range - 1;
var dist = target.CenterLocation - self.CenterLocation;
var desiredFacing = Util.GetFacing(dist, unit.Facing);
Util.TickFacing(ref unit.Facing, desiredFacing, self.LegacyInfo.ROT);
Util.TickFacing(ref unit.Facing, desiredFacing, self.Info.Traits.Get<HelicopterInfo>().ROT);
if (!float2.WithinEpsilon(float2.Zero, dist, range * Game.CellSize))
{

View File

@@ -28,7 +28,7 @@ namespace OpenRa.Game.Traits.Activities
--unit.Altitude;
var desiredFacing = Util.GetFacing(d, unit.Facing);
Util.TickFacing(ref unit.Facing, desiredFacing, self.LegacyInfo.ROT);
Util.TickFacing(ref unit.Facing, desiredFacing, self.Info.Traits.Get<PlaneInfo>().ROT);
var speed = .2f * Util.GetEffectiveSpeed(self);
var angle = unit.Facing / 128f * Math.PI;

View File

@@ -44,7 +44,7 @@ namespace OpenRa.Game.Traits
int2 detonateLocation = self.CenterLocation.ToInt2();
Game.world.AddFrameEndTask(
w => w.Add(new Bullet(self.LegacyInfo.Primary, detonatedBy.Owner, detonatedBy,
w => w.Add(new Bullet(self.Info.Traits.WithInterface<AttackBaseInfo>().First().PrimaryWeapon, detonatedBy.Owner, detonatedBy,
detonateLocation, detonateLocation, altitude, altitude)));
}
}

View File

@@ -63,14 +63,15 @@ namespace OpenRa.Game.Traits
if (res != null)
reservation = res.Reserve(self);
var offset = (order.TargetActor.LegacyInfo as LegacyBuildingInfo).SpawnOffset;
var productionInfo = order.TargetActor.Info.Traits.Get<ProductionInfo>();
var offset = productionInfo.SpawnOffset;
var offsetVec = offset != null ? new float2(offset[0], offset[1]) : float2.Zero;
self.CancelActivity();
self.QueueActivity(new HeliFly(order.TargetActor.CenterLocation + offsetVec));
self.QueueActivity(new Turn(self.LegacyInfo.InitialFacing));
self.QueueActivity(new Turn(self.Info.Traits.WithInterface<OwnedActorInfo>().FirstOrDefault().InitialFacing));
self.QueueActivity(new HeliLand(false));
self.QueueActivity(order.TargetActor.LegacyInfo == Rules.UnitInfo["HPAD"]
self.QueueActivity(order.TargetActor.Info.Name == "hpad"
? (IActivity)new Rearm() : new Repair());
}
}

View File

@@ -26,7 +26,7 @@ namespace OpenRa.Game.Traits
public RenderWarFactory(Actor self)
{
this.self = self;
roof = new Animation(self.LegacyInfo.Image ?? self.LegacyInfo.Name);
roof = new Animation(self.traits.WithInterface<RenderSimple>().First().GetImage(self));
}
public void BuildingComplete( Actor self )