Import infantry subcell and actor stance
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user