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

@@ -42,16 +42,21 @@ namespace OpenRA.Mods.RA
class CrateInfo : ITraitInfo, ITraitPrerequisite<RenderSimpleInfo>
{
public readonly int Lifetime = 5; // Seconds
public object Create(ActorInitializer init) { return new Crate(init.self); }
public object Create(ActorInitializer init) { return new Crate(init); }
}
class Crate : ICrushable, IOccupySpace, ITick
{
readonly Actor self;
[Sync]
readonly int2 location;
[Sync]
int ticks;
public Crate(Actor self)
public Crate(ActorInitializer init)
{
this.self = self;
this.self = init.self;
this.location = init.location;
self.World.WorldActor.traits.Get<UnitInfluence>().Add(self, this);
}
@@ -75,7 +80,9 @@ namespace OpenRA.Mods.RA
public bool IsPathableCrush(UnitMovementType umt, Player player) { return true; }
public bool IsCrushableBy(UnitMovementType umt, Player player) { return true; }
public IEnumerable<int2> OccupiedCells() { yield return self.Location; }
public int2 TopLeft { get { return location; } }
public IEnumerable<int2> OccupiedCells() { yield return TopLeft; }
public void Tick(Actor self)
{