OpenRA.GameRules.WeaponInfo.Impact C# (CSharp) Method

Impact() public method

Applies all the weapon's warheads to the target.
public Impact ( Target target, Actor firedBy, IEnumerable damageModifiers ) : void
target OpenRA.Traits.Target
firedBy Actor
damageModifiers IEnumerable
return void
        public void Impact(Target target, Actor firedBy, IEnumerable<int> damageModifiers)
        {
            foreach (var warhead in Warheads)
            {
                var wh = warhead; // force the closure to bind to the current warhead

                Action a = () => wh.DoImpact(target, firedBy, damageModifiers);
                if (wh.Delay > 0)
                    firedBy.World.AddFrameEndTask(w => w.Add(new DelayedAction(wh.Delay, a)));
                else
                    a();
            }
        }