moved inner classes out of UnitInfo for brevity. added money-up and money-down sounds. added slow view of money changes, like real-ra.

This commit is contained in:
Chris Forbes
2009-11-29 15:26:55 +13:00
parent 9860b35030
commit da84b66424
17 changed files with 96 additions and 77 deletions

View File

@@ -180,7 +180,7 @@ namespace OpenRa.Game.Traits.Activities
var oldFraction = moveFraction;
var oldTotal = moveFractionTotal;
moveFraction += ( self.unitInfo as UnitInfo.MobileInfo ).Speed;
moveFraction += ( self.unitInfo as MobileInfo ).Speed;
UpdateCenterLocation( self, mobile );
if( moveFraction >= moveFractionTotal )
{

View File

@@ -8,11 +8,11 @@ namespace OpenRa.Game.Traits
{
class Building : ITick, INotifyBuildComplete
{
public readonly UnitInfo.BuildingInfo unitInfo;
public readonly BuildingInfo unitInfo;
public Building(Actor self)
{
unitInfo = (UnitInfo.BuildingInfo)self.unitInfo;
unitInfo = (BuildingInfo)self.unitInfo;
}
bool first = true;

View File

@@ -52,7 +52,7 @@ namespace OpenRa.Game.Traits
self.unitInfo.ROT);
// .6f going the wrong way; .8f going sideways, 1f going forward.
var rawSpeed = .2f * (self.unitInfo as UnitInfo.VehicleInfo).Speed;
var rawSpeed = .2f * (self.unitInfo as VehicleInfo).Speed;
var angle = (unit.Facing - desiredFacing) / 128f * Math.PI;
var scale = .4f + .6f * (float)Math.Cos(angle);

View File

@@ -22,7 +22,7 @@ namespace OpenRa.Game.Traits
public InfantrySquad(Actor self)
{
var ii = (UnitInfo.InfantryInfo)self.unitInfo;
var ii = (InfantryInfo)self.unitInfo;
for (int i = 0; i < ii.SquadSize; i++)
elements.Add(new Soldier(self.unitInfo.Name,
self.CenterLocation.ToInt2() + elementOffsets[ii.SquadSize][i]));
@@ -72,7 +72,7 @@ namespace OpenRa.Game.Traits
anim.PlayFetchIndex("stand",
() => Util.QuantizeFacing(facing, anim.CurrentSequence.Length));
location = initialLocation;
speed = ((UnitInfo.InfantryInfo)Rules.UnitInfo[name]).Speed / 2;
speed = ((InfantryInfo)Rules.UnitInfo[name]).Speed / 2;
}
public void Tick( int2 desiredLocation, Actor self )

View File

@@ -22,7 +22,7 @@ namespace OpenRa.Game.Traits
{
if( order.OrderString == "DeployMcv" )
{
var factBuildingInfo = (UnitInfo.BuildingInfo)Rules.UnitInfo[ "fact" ];
var factBuildingInfo = (BuildingInfo)Rules.UnitInfo[ "fact" ];
if( Game.CanPlaceBuilding( factBuildingInfo, self.Location - new int2( 1, 1 ), self, false ) )
{
self.CancelActivity();

View File

@@ -16,8 +16,6 @@ namespace OpenRa.Game.Traits
public int2 fromCell { get { return __fromCell; } set { Game.UnitInfluence.Remove( this ); __fromCell = value; Game.UnitInfluence.Add( this ); } }
public int2 toCell { get { return self.Location; } set { Game.UnitInfluence.Remove( this ); self.Location = value; Game.UnitInfluence.Add( this ); } }
public int Voice = Game.CosmeticRandom.Next(2);
public Mobile(Actor self)
{
this.self = self;
@@ -62,7 +60,7 @@ namespace OpenRa.Game.Traits
case "Infantry":
return UnitMovementType.Foot;
case "Vehicle":
return ( self.unitInfo as UnitInfo.VehicleInfo ).Tracked ? UnitMovementType.Track : UnitMovementType.Wheel;
return ( self.unitInfo as VehicleInfo ).Tracked ? UnitMovementType.Track : UnitMovementType.Wheel;
case "Ship":
return UnitMovementType.Float;
case "Plane":