war factory behavior is sortof sane, if glitchy

This commit is contained in:
Chris Forbes
2009-10-24 19:41:16 +13:00
parent 4aa172a7a7
commit 801c47daa6
2 changed files with 35 additions and 3 deletions

View File

@@ -11,6 +11,7 @@ namespace OpenRa.Game.Traits
{
public Animation roof;
bool doneBuilding;
bool isOpen;
public readonly Actor self;
public RenderWarFactory(Actor self)
@@ -37,14 +38,22 @@ namespace OpenRa.Game.Traits
{
base.Tick(self);
roof.Tick();
var b = self.Bounds;
if (isOpen && !Game.SelectUnitsInBox(
new float2(b.Left, b.Top),
new float2(b.Right, b.Bottom)).Any(a => a.traits.Contains<Mobile>()))
{
isOpen = false;
roof.PlayBackwardsThen("build-top", () => roof.Play("idle-top"));
}
}
public void EjectUnit()
{
/* todo: hold the door open */
roof.PlayThen("build-top",
() => roof.PlayRepeating("idle-top"));
roof.PlayThen("build-top", () => isOpen = true);
}
}
}