Example #1
0
        /// <summary>
        /// Replaces the current items with the specified items.
        /// </summary>
        /// <remarks>
        /// <para>
        /// To use this method safely either set <paramref name="asReference"/> to false or
        /// discard all external refrences to <paramref name="items"/>.
        /// </para>
        /// </remarks>
        /// <param name="bodyParts">The object to update. (Required)</param>
        /// <param name="items">The items.</param>
        /// <param name="asReference">
        /// If true the internal buffer will be replaced with a reference to
        /// <paramref name="items"/>, otherwise <paramref name="items"/> will be copied.
        /// </param>
        public static void UnsafeReplaceItems(
            BodyPartGroup bodyParts, bool asReference, params BodyPart[] items)
        {
            // Null elements are allowed.

            if (items == null)
            {
                bodyParts.Clear(0);
            }
            else
            {
                bodyParts.m_Items = asReference ? items : (BodyPart[])items.Clone();
            }
        }
 /// <summary>
 /// Replaces the current body parts with the provided body parts.
 /// </summary>
 /// <remarks>
 /// <para>
 /// Behavior is undefined if this method if used after outfit initialization.
 /// </para>
 /// <para>
 /// If <paramref name="asReference"/> is true, then all external references to the body part array must be
 /// discared or behavior will be undefined.
 /// </para>
 /// </remarks>
 /// <param name="outfit">The outfit. (Required)</param>
 /// <param name="asReference">
 /// If true the outfit will use the reference to the body part rray.  Otherwise the array will be copied.
 /// </param>
 /// <param name="mountPoints">The body parts, or null to clear all body parts.</param>
 public static void UnsafeSet(
     StandardOutfit outfit, bool asReference, params BodyPart[] bodyParts)
 {
     BodyPartGroup.UnsafeReplaceItems(outfit.m_Parts, asReference, bodyParts);
 }