示例#1
0
        /// <summary>
        /// Adds a behavior to a stunt.
        /// </summary>
        public static TStunt AddBehavior <TStunt>(this TStunt stunt, IStuntBehavior behavior)
        {
            if (stunt is IStunt target)
            {
                target.Behaviors.Add(behavior);
            }
            else
            {
                throw new ArgumentException(nameof(stunt));
            }

            return(stunt);
        }
示例#2
0
        /// <summary>
        /// Inserts a behavior into the stunt behavior pipeline at the specified
        /// index.
        /// </summary>
        public static TStunt InsertBehavior <TStunt>(this TStunt stunt, int index, IStuntBehavior behavior)
        {
            if (stunt is IStunt target)
            {
                target.Behaviors.Insert(index, behavior);
            }
            else
            {
                throw new ArgumentException(nameof(stunt));
            }

            return(stunt);
        }
示例#3
0
 /// <summary>
 /// Inserts a behavior into the stunt behavior pipeline at the specified
 /// index.
 /// </summary>
 public static IStunt InsertBehavior(this IStunt stunt, int index, IStuntBehavior behavior)
 {
     stunt.Behaviors.Insert(index, behavior);
     return(stunt);
 }
示例#4
0
 /// <summary>
 /// Adds a behavior to a stunt.
 /// </summary>
 public static IStunt AddBehavior(this IStunt stunt, IStuntBehavior behavior)
 {
     stunt.Behaviors.Add(behavior);
     return(stunt);
 }