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:
@@ -9,12 +9,12 @@ namespace OpenRa.Game.GameRules
|
||||
{
|
||||
static class Footprint
|
||||
{
|
||||
public static IEnumerable<int2> Tiles( UnitInfo.BuildingInfo buildingInfo, int2 position )
|
||||
public static IEnumerable<int2> Tiles( BuildingInfo buildingInfo, int2 position )
|
||||
{
|
||||
return Tiles(buildingInfo, position, true);
|
||||
}
|
||||
|
||||
public static IEnumerable<int2> Tiles( UnitInfo.BuildingInfo buildingInfo, int2 position, bool adjustForPlacement )
|
||||
public static IEnumerable<int2> Tiles( BuildingInfo buildingInfo, int2 position, bool adjustForPlacement )
|
||||
{
|
||||
var dim = buildingInfo.Dimensions;
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace OpenRa.Game.GameRules
|
||||
return Tiles( building.unitInfo, a.Location, false );
|
||||
}
|
||||
|
||||
public static IEnumerable<int2> UnpathableTiles( UnitInfo.BuildingInfo buildingInfo, int2 position )
|
||||
public static IEnumerable<int2> UnpathableTiles( BuildingInfo buildingInfo, int2 position )
|
||||
{
|
||||
var footprint = buildingInfo.Footprint.Where( x => !char.IsWhiteSpace( x ) ).ToArray();
|
||||
foreach( var tile in TilesWhere( buildingInfo.Name, buildingInfo.Dimensions, footprint, a => a == 'x' ) )
|
||||
@@ -55,7 +55,7 @@ namespace OpenRa.Game.GameRules
|
||||
yield return new int2( x, y );
|
||||
}
|
||||
|
||||
public static int2 AdjustForBuildingSize( UnitInfo.BuildingInfo unitInfo )
|
||||
public static int2 AdjustForBuildingSize( BuildingInfo unitInfo )
|
||||
{
|
||||
var dim = unitInfo.Dimensions;
|
||||
return new int2( dim.X / 2, dim.Y > 1 ? ( dim.Y + 1 ) / 2 : 0 );
|
||||
|
||||
@@ -53,12 +53,12 @@ namespace OpenRa.Game
|
||||
UnitCategory = Categories.SelectMany(x => x.Value.Select(y => new KeyValuePair<string, string>(y, x.Key))).ToDictionary(x => x.Key, x => x.Value);
|
||||
|
||||
UnitInfo = new InfoLoader<UnitInfo>(
|
||||
Pair.New<string, Func<string, UnitInfo>>("Building", s => new UnitInfo.BuildingInfo(s)),
|
||||
Pair.New<string, Func<string, UnitInfo>>("Defense", s => new UnitInfo.BuildingInfo(s)),
|
||||
Pair.New<string, Func<string, UnitInfo>>("Infantry", s => new UnitInfo.InfantryInfo(s)),
|
||||
Pair.New<string, Func<string, UnitInfo>>("Vehicle", s => new UnitInfo.VehicleInfo(s)),
|
||||
Pair.New<string, Func<string, UnitInfo>>("Ship", s => new UnitInfo.VehicleInfo(s)),
|
||||
Pair.New<string, Func<string, UnitInfo>>("Plane", s => new UnitInfo.VehicleInfo(s)));
|
||||
Pair.New<string, Func<string, UnitInfo>>("Building", s => new BuildingInfo(s)),
|
||||
Pair.New<string, Func<string, UnitInfo>>("Defense", s => new BuildingInfo(s)),
|
||||
Pair.New<string, Func<string, UnitInfo>>("Infantry", s => new InfantryInfo(s)),
|
||||
Pair.New<string, Func<string, UnitInfo>>("Vehicle", s => new VehicleInfo(s)),
|
||||
Pair.New<string, Func<string, UnitInfo>>("Ship", s => new VehicleInfo(s)),
|
||||
Pair.New<string, Func<string, UnitInfo>>("Plane", s => new VehicleInfo(s)));
|
||||
|
||||
LoadCategories(
|
||||
"Weapon",
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace OpenRa.Game.GameRules
|
||||
{
|
||||
foreach( var b in Rules.Categories[ "Building" ] )
|
||||
{
|
||||
var info = (UnitInfo.BuildingInfo)Rules.UnitInfo[ b ];
|
||||
var info = (BuildingInfo)Rules.UnitInfo[ b ];
|
||||
foreach( var p in info.Produces )
|
||||
producesIndex[ p ].Add( info );
|
||||
}
|
||||
@@ -23,7 +23,7 @@ namespace OpenRa.Game.GameRules
|
||||
public Cache<string, List<Actor>> GatherBuildings( Player player )
|
||||
{
|
||||
var ret = new Cache<string, List<Actor>>( x => new List<Actor>() );
|
||||
foreach( var b in Game.world.Actors.Where( x => x.Owner == player && x.unitInfo is UnitInfo.BuildingInfo ) )
|
||||
foreach( var b in Game.world.Actors.Where( x => x.Owner == player && x.unitInfo is BuildingInfo ) )
|
||||
ret[ b.unitInfo.Name ].Add( b );
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -56,54 +56,54 @@ namespace OpenRa.Game.GameRules
|
||||
public readonly int InitialFacing = 128;
|
||||
|
||||
public UnitInfo(string name) { Name = name; }
|
||||
}
|
||||
|
||||
public class MobileInfo : UnitInfo
|
||||
{
|
||||
public readonly int Passengers = 0;
|
||||
public readonly int Speed = 0;
|
||||
public readonly bool NoMovingFire = false;
|
||||
public class MobileInfo : UnitInfo
|
||||
{
|
||||
public readonly int Passengers = 0;
|
||||
public readonly int Speed = 0;
|
||||
public readonly bool NoMovingFire = false;
|
||||
|
||||
public MobileInfo(string name) : base(name) { }
|
||||
}
|
||||
public MobileInfo(string name) : base(name) { }
|
||||
}
|
||||
|
||||
public class InfantryInfo : MobileInfo
|
||||
{
|
||||
public readonly bool Crushable = true; // also on VehicleInfo, but with a different default
|
||||
public readonly bool C4 = false;
|
||||
public readonly bool FraidyCat = false;
|
||||
public readonly bool Infiltrate = false;
|
||||
public readonly bool IsCanine = false;
|
||||
public readonly int SquadSize = 1;
|
||||
public class InfantryInfo : MobileInfo
|
||||
{
|
||||
public readonly bool Crushable = true; // also on VehicleInfo, but with a different default
|
||||
public readonly bool C4 = false;
|
||||
public readonly bool FraidyCat = false;
|
||||
public readonly bool Infiltrate = false;
|
||||
public readonly bool IsCanine = false;
|
||||
public readonly int SquadSize = 1;
|
||||
|
||||
public InfantryInfo(string name) : base(name) { }
|
||||
}
|
||||
public InfantryInfo(string name) : base(name) { }
|
||||
}
|
||||
|
||||
public class VehicleInfo : MobileInfo
|
||||
{
|
||||
public readonly bool Crushable = false;
|
||||
public readonly bool Tracked = false;
|
||||
public class VehicleInfo : MobileInfo
|
||||
{
|
||||
public readonly bool Crushable = false;
|
||||
public readonly bool Tracked = false;
|
||||
|
||||
public VehicleInfo(string name) : base(name) { }
|
||||
}
|
||||
public VehicleInfo(string name) : base(name) { }
|
||||
}
|
||||
|
||||
public class BuildingInfo : UnitInfo
|
||||
{
|
||||
public readonly int2 Dimensions = new int2( 1, 1 );
|
||||
public readonly string Footprint = "x";
|
||||
public readonly string[] Produces = { };
|
||||
public class BuildingInfo : UnitInfo
|
||||
{
|
||||
public readonly int2 Dimensions = new int2(1, 1);
|
||||
public readonly string Footprint = "x";
|
||||
public readonly string[] Produces = { };
|
||||
|
||||
public readonly bool BaseNormal = true;
|
||||
public readonly int Adjacent = 1;
|
||||
public readonly bool Bib = false;
|
||||
public readonly bool Capturable = false;
|
||||
public readonly int Power = 0;
|
||||
public readonly bool Powered = false;
|
||||
public readonly bool Repairable = true;
|
||||
public readonly int Storage = 0;
|
||||
public readonly bool Unsellable = false;
|
||||
public readonly int[] RallyPoint = { 1, 3 };
|
||||
public readonly bool BaseNormal = true;
|
||||
public readonly int Adjacent = 1;
|
||||
public readonly bool Bib = false;
|
||||
public readonly bool Capturable = false;
|
||||
public readonly int Power = 0;
|
||||
public readonly bool Powered = false;
|
||||
public readonly bool Repairable = true;
|
||||
public readonly int Storage = 0;
|
||||
public readonly bool Unsellable = false;
|
||||
public readonly int[] RallyPoint = { 1, 3 };
|
||||
|
||||
public BuildingInfo(string name) : base(name) { }
|
||||
}
|
||||
public BuildingInfo(string name) : base(name) { }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user