Пример #1
0
        /// <summary>
        /// Adds a behavior to a avatar.
        /// </summary>
        /// <param name="avatar">The avatar to add the behavior to.</param>
        /// <param name="behavior">A custom behavior to apply to the avatar.</param>
        //[EditorBrowsable(EditorBrowsableState.Advanced)]
        public static TAvatar AddBehavior <TAvatar>(this TAvatar avatar, IAvatarBehavior behavior)
        {
            if (avatar is IAvatar target)
            {
                target.Behaviors.Add(behavior);
            }
            else
            {
                throw new ArgumentException(nameof(avatar));
            }

            return(avatar);
        }
Пример #2
0
        /// <summary>
        /// Inserts a behavior into the avatar behavior pipeline at the specified
        /// index.
        /// </summary>
        /// <param name="avatar">The avatar to add the behavior to.</param>
        /// <param name="index">The index to insert the behavior at.</param>
        /// <param name="behavior">A custom behavior to apply to the avatar.</param>
        //[EditorBrowsable(EditorBrowsableState.Advanced)]
        public static TAvatar InsertBehavior <TAvatar>(this TAvatar avatar, int index, IAvatarBehavior behavior)
        {
            if (avatar is IAvatar target)
            {
                target.Behaviors.Insert(index, behavior);
            }
            else
            {
                throw new ArgumentException(nameof(avatar));
            }

            return(avatar);
        }
Пример #3
0
 /// <summary>
 /// Adds a behavior to an avatar.
 /// </summary>
 /// <param name="avatar">The avatar to add the behavior to.</param>
 /// <param name="behavior">A custom behavior to apply to the avatar.</param>
 public static IAvatar AddBehavior(this IAvatar avatar, IAvatarBehavior behavior)
 {
     avatar.Behaviors.Add(behavior);
     return(avatar);
 }
Пример #4
0
 /// <summary>
 /// Inserts a behavior into the avatar behavior pipeline at the specified
 /// index.
 /// </summary>
 /// <param name="avatar">The avatar to add the behavior to.</param>
 /// <param name="index">The index to insert the behavior at.</param>
 /// <param name="behavior">A custom behavior to apply to the avatar.</param>
 public static IAvatar InsertBehavior(this IAvatar avatar, int index, IAvatarBehavior behavior)
 {
     avatar.Behaviors.Insert(index, behavior);
     return(avatar);
 }