Refactoring + cnc weap

This commit is contained in:
Paul Chote
2010-08-03 01:03:31 +12:00
parent 7c562059c2
commit 053f0f5c7f
6 changed files with 38 additions and 47 deletions

View File

@@ -24,7 +24,9 @@ namespace OpenRA.Mods.RA.Render
public Animation roof;
[Sync]
bool isOpen;
[Sync]
int2 openExit;
string GetPrefix(Actor self)
{
return self.GetDamageState() >= DamageState.Heavy ? "damaged-" : "";
@@ -44,7 +46,7 @@ namespace OpenRA.Mods.RA.Render
public void Tick(Actor self)
{
if (isOpen && !self.World.WorldActor.traits.Get<UnitInfluence>()
.GetUnitsAt(((1f/Game.CellSize) * self.CenterLocation).ToInt2()).Any())
.GetUnitsAt(openExit).Any())
{
isOpen = false;
roof.PlayBackwardsThen(GetPrefix(self) + "build-top", () => roof.Play(GetPrefix(self) + "idle-top"));
@@ -61,9 +63,9 @@ namespace OpenRA.Mods.RA.Render
roof.ReplaceAnim(roof.CurrentSequence.Name.Replace("damaged-",""));
}
public void UnitProduced(Actor self, Actor other)
public void UnitProduced(Actor self, Actor other, int2 exit)
{
roof.PlayThen(GetPrefix(self) + "build-top", () => isOpen = true);
roof.PlayThen(GetPrefix(self) + "build-top", () => {isOpen = true; openExit = exit;});
}
public void Selling( Actor self )