movementtype

This commit is contained in:
Chris Forbes
2010-01-12 21:59:26 +13:00
parent 02b9415277
commit ee14b0a670
5 changed files with 37 additions and 45 deletions

View File

@@ -7,6 +7,8 @@ namespace OpenRa.Game.Traits
{
class MobileInfo : ITraitInfo
{
public readonly UnitMovementType MovementType = UnitMovementType.Wheel;
public object Create(Actor self) { return new Mobile(self); }
}
@@ -83,19 +85,7 @@ namespace OpenRa.Game.Traits
public UnitMovementType GetMovementType()
{
switch (Rules.UnitCategory[self.Info.Name])
{
case "Infantry":
return UnitMovementType.Foot;
case "Vehicle":
return (self.LegacyInfo as VehicleInfo).Tracked ? UnitMovementType.Track : UnitMovementType.Wheel;
case "Ship":
return UnitMovementType.Float;
case "Plane":
return UnitMovementType.Fly;
default:
throw new InvalidOperationException("GetMovementType on unit that shouldn't be able to move.");
}
return self.Info.Traits.Get<MobileInfo>().MovementType;
}
public bool CanEnterCell(int2 a)