Ejemplo n.º 1
0
        public void Repair(Actor repairer, bool continueNorth, bool continueSouth)
        {
            // Repair self
            var initialDamage = Health.DamageState;

            self.World.AddFrameEndTask(w =>
            {
                if (Health.IsDead)
                {
                    Health.Resurrect(self, repairer);
                    killedUnits = false;
                    KillUnitsOnBridge();
                }
                else
                {
                    Health.InflictDamage(self, repairer, -Health.MaxHP, null, true);
                }
            });

            // Repair adjacent spans (long bridges)
            if (continueNorth && northNeighbour != null)
            {
                var delay = initialDamage == DamageState.Undamaged || NeighbourIsDeadShore(northNeighbour) ?
                            0 : Info.RepairPropagationDelay;

                self.World.AddFrameEndTask(w => w.Add(new DelayedAction(delay, () =>
                                                                        northNeighbour.Repair(repairer, true, false))));
            }

            if (continueSouth && southNeighbour != null)
            {
                var delay = initialDamage == DamageState.Undamaged || NeighbourIsDeadShore(southNeighbour) ?
                            0 : Info.RepairPropagationDelay;

                self.World.AddFrameEndTask(w => w.Add(new DelayedAction(delay, () =>
                                                                        southNeighbour.Repair(repairer, false, true))));
            }
        }
Ejemplo n.º 2
0
 public void Repair(Actor repairer)
 {
     bridge.Repair(repairer, true, true);
 }