Import infantry subcell and actor stance

This commit is contained in:
Paul Chote
2010-08-17 14:00:01 +12:00
parent 73dadbc873
commit 142be86934
8 changed files with 167 additions and 32 deletions

View File

@@ -1,3 +1,4 @@
using OpenRA.FileFormats;
#region Copyright & License Information
/*
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
@@ -10,11 +11,19 @@
namespace OpenRA.Traits
{
class SharesCellInfo : TraitInfo<SharesCell> {}
class SharesCellInfo : ITraitInfo
{
public object Create(ActorInitializer init) { return new SharesCell(init); }
}
public class SharesCell : IOffsetCenterLocation
{
[Sync]
public int Position;
public SharesCell(ActorInitializer init)
{
Position = init.Contains<SubcellInit>() ? init.Get<SubcellInit,int>() : 0;
}
public float2 CenterOffset
{ get {
@@ -32,5 +41,23 @@ namespace OpenRA.Traits
return new float2(-5f, -5f);
}
}}
}
public class SubcellInit : IActorInit<int>
{
[FieldFromYamlKey]
public readonly int value = 0;
public SubcellInit() { }
public SubcellInit( int init )
{
value = init;
}
public int Value( World world )
{
return value;
}
}
}