Iron curtain power implementation; Remove AutoActivate attribute to be part of the GPS implementation

This commit is contained in:
Paul Chote
2010-01-09 00:21:39 +13:00
parent d93a7b766a
commit 86b0ee8c97
12 changed files with 101 additions and 55 deletions

View File

@@ -37,7 +37,9 @@ namespace OpenRa.Game
public bool IsDone { get { return RemainingTime == 0; } }
public int RemainingTime { get; private set; }
public int TotalTime { get; private set; }
bool notifiedReady = false;
bool notifiedCharging = false;
public void Tick()
{
if (Info.OneShot && IsUsed)
@@ -59,10 +61,20 @@ namespace OpenRa.Game
if (IsAvailable && (!Info.Powered || Owner.GetPowerState() == PowerState.Normal))
{
if (RemainingTime > 0) --RemainingTime;
if (!notifiedCharging)
{
Impl.IsChargingNotification(this);
notifiedCharging = true;
}
}
if (RemainingTime == 0 && Info.AutoActivate)
Activate();
if (RemainingTime == 0
&& Impl != null
&& !notifiedReady)
{
Impl.IsReadyNotification(this);
notifiedReady = true;
}
}
public void Activate()
@@ -79,6 +91,8 @@ namespace OpenRa.Game
IsAvailable = false;
}
RemainingTime = TotalTime;
notifiedReady = false;
notifiedCharging = false;
}
public void Give(bool requireCharge) // called by crate/spy/etc code