Introduce ScreenMap trait for caching screen-coord queries.

This commit is contained in:
Paul Chote
2013-09-21 13:39:39 +12:00
parent cad46e43c5
commit dfd51c0caa
24 changed files with 281 additions and 96 deletions

View File

@@ -97,7 +97,7 @@ namespace OpenRA.Mods.RA.Buildings
}
}
public class Building : INotifyDamage, IOccupySpace, INotifyCapture, ISync, ITechTreePrerequisite
public class Building : INotifyDamage, IOccupySpace, INotifyCapture, ISync, ITechTreePrerequisite, INotifyAddedToWorld, INotifyRemovedFromWorld
{
readonly Actor self;
public readonly BuildingInfo Info;
@@ -157,5 +157,15 @@ namespace OpenRA.Mods.RA.Buildings
{
PlayerPower = newOwner.PlayerActor.Trait<PowerManager>();
}
public void AddedToWorld(Actor self)
{
self.World.ScreenMap.Add(self);
}
public void RemovedFromWorld(Actor self)
{
self.World.ScreenMap.Remove(self);
}
}
}