private void AttachPack(Object sender, EventArgs args) { while (toAttach.Count > 0) { ParentHolder.Attach(toAttach.Dequeue()); } }
public BehaviorPack(float lifetime = -1) : base(lifetime) { AliveChanged += (behavior) => { while (toAttach.Count > 0) { ParentHolder.Attach(toAttach.Dequeue()); } }; }
public SampleAction2() : base(1) { // the public delegates and events can either // have functions hooked into them: //this.AliveChanged += AttachPack; // or lambdas this.AliveChanged += (Action a) => { while (toAttach.Count > 0) { ParentHolder.Attach(toAttach.Dequeue()); } }; }