added BuildableInfo

This commit is contained in:
Chris Forbes
2010-01-10 12:38:26 +13:00
parent 5fb2f91281
commit 7a8ab81c91
3 changed files with 17 additions and 3 deletions

View File

@@ -21,6 +21,8 @@ namespace OpenRa.Game.GameRules
foreach (var x in my.Nodes) foreach (var x in my.Nodes)
{ {
var field = self.GetType().GetField(x.Key.Trim()); var field = self.GetType().GetField(x.Key.Trim());
if (field == null)
throw new NotImplementedException("Missing field `{0}` on `{1}`".F(x.Key.Trim(), self.GetType().Name));
field.SetValue(self, GetValue(field.FieldType, x.Value.Value.Trim())); field.SetValue(self, GetValue(field.FieldType, x.Value.Value.Trim()));
} }
} }

View File

@@ -5,6 +5,18 @@ using System.Text;
namespace OpenRa.Game.Traits namespace OpenRa.Game.Traits
{ {
class BuildableInfo : ITraitInfo
{
public readonly int TechLevel = -1;
public readonly string Tab = null;
public readonly string[] Prerequisites = { };
public readonly Race[] Owner = { };
public readonly int Cost = 0;
public readonly string Description = "";
public readonly string LongDesc = "";
public object Create(Actor self) { return new Buildable(self); }
}
class Buildable class Buildable
{ {
public Buildable( Actor self ) { } public Buildable( Actor self ) { }

View File

@@ -7,9 +7,9 @@ namespace OpenRa.Game.Traits
{ {
class MobileInfo : ITraitInfo class MobileInfo : ITraitInfo
{ {
public readonly int Sight; public readonly int Sight = 0;
public readonly int ROT; public readonly int ROT = 0;
public readonly int Speed; public readonly int Speed = 0;
public object Create(Actor self) { return new Mobile(self); } public object Create(Actor self) { return new Mobile(self); }
} }