moving Actor.Location onto the appropriate traits (bob)

This commit is contained in:
Chris Forbes
2010-06-19 14:37:06 +12:00
parent db465e1fdd
commit 66adbee2a6
25 changed files with 218 additions and 103 deletions

View File

@@ -8,18 +8,24 @@ namespace OpenRA.Mods.RA
{
class HuskInfo : ITraitInfo
{
public object Create( ActorInitializer init ) { return new Husk( init.self ); }
public object Create( ActorInitializer init ) { return new Husk( init ); }
}
class Husk : IOccupySpace
{
Actor self;
public Husk(Actor self)
[Sync]
int2 location;
public Husk(ActorInitializer init)
{
this.self = self;
this.self = init.self;
this.location = init.location;
self.World.WorldActor.traits.Get<UnitInfluence>().Add(self, this);
}
public IEnumerable<int2> OccupiedCells() { yield return self.Location; }
public int2 TopLeft { get { return location; } }
public IEnumerable<int2> OccupiedCells() { yield return TopLeft; }
}
}