/// <summary>
 /// Set next link.
 /// </summary>
 /// <param name="next"> Next link. </param>
 public void SetNext(ChainLinkBehavior next)
 {
     if (this.nextLink == null)
     {
         this.nextLink = next;
     }
     else
     {
         this.nextLink.SetNext(next);
     }
 }
        /// <summary>
        /// Add link.
        /// </summary>
        /// <param name="checkFunc"> Check function. </param>
        /// <param name="behaviorFactory"> Behavior factory. </param>
        public void AddLink(Func <IEffect, bool> checkFunc, Func <IBehavior> behaviorFactory)
        {
            if (checkFunc == null)
            {
                throw new ArgumentNullException("checkFunc");
            }

            if (behaviorFactory == null)
            {
                throw new ArgumentNullException("behaviorFactory");
            }

            var cl = new ChainLinkBehavior(checkFunc, behaviorFactory, this.firstOnly);

            if (this.firstChainLink == null)
            {
                this.firstChainLink = cl;
            }
            else
            {
                this.firstChainLink.SetNext(cl);
            }
        }