public override Activity Tick(Actor self) { if (IsCanceled || limitedAmmo == null) { return(NextActivity); } if (--remainingTicks == 0) { if (!limitedAmmo.GiveAmmo()) { return(NextActivity); } var hostBuilding = self.World.ActorMap.GetUnitsAt(self.Location) .FirstOrDefault(a => a.HasTrait <RenderBuilding>()); if (hostBuilding != null) { hostBuilding.Trait <RenderBuilding>().PlayCustomAnim(hostBuilding, "active"); } remainingTicks = limitedAmmo.ReloadTimePerAmmo(); } return(this); }
public Rearm(Actor self) { limitedAmmo = self.TraitOrDefault <LimitedAmmo>(); if (limitedAmmo != null) { ticksPerPip = limitedAmmo.ReloadTimePerAmmo(); } remainingTicks = ticksPerPip; }
public override Activity Tick(Actor self) { if (IsCanceled || limitedAmmo == null) { return(NextActivity); } if (--remainingTicks == 0) { var hostBuilding = self.World.ActorMap.GetUnitsAt(self.Location) .FirstOrDefault(a => a.HasTrait <RenderBuilding>()); if (!limitedAmmo.GiveAmmo()) { var helicopter = self.TraitOrDefault <Helicopter>(); if (helicopter != null) { if (helicopter.Info.RepairBuildings.Contains(hostBuilding.Info.Name) && self.HasTrait <Health>()) { if (self.Trait <Health>().DamageState != DamageState.Undamaged) { return(NextActivity); } } return(helicopter.TakeOff(hostBuilding)); } return(NextActivity); } if (hostBuilding != null) { hostBuilding.Trait <RenderBuilding>().PlayCustomAnim(hostBuilding, "active"); } remainingTicks = limitedAmmo.ReloadTimePerAmmo(); } return(this); }
public Rearm(Actor self) { limitedAmmo = self.Trait <LimitedAmmo>(); remainingTicks = limitedAmmo.ReloadTimePerAmmo(); }