/// <summary>
        /// Synchronize the body part state of all common body parts.
        /// </summary>
        /// <param name="to">The outfit being synchonized to. (Required)</param>
        /// <param name="from">The outfit state is syncronzied from. (Required)</param>
        /// <param name="includeStatus">Synchronize the collider status.</param>
        /// <param name="includeLayer">Synchronize the collider layer.</param>
        /// <param name="includeContext">
        /// Synchronize the context unless it is the <paramref name="from"/> object's GameObject.
        /// </param>
        public static void SynchronizeBodyPartState(
            Outfit to, Outfit from, bool includeStatus, bool includeLayer, bool includeContext)
        {
            if (!(from && to))
            {
                return;
            }

            for (int i = 0; i < from.BodyPartCount; i++)
            {
                var prevPart = from.GetBodyPart(i);
                if (prevPart)
                {
                    var part = to.GetBodyPart(prevPart.PartType);
                    if (part)
                    {
                        BodyPart.Synchronize(
                            part, prevPart, includeStatus, includeLayer, includeContext, from.gameObject);
                    }
                }
            }
        }
示例#2
0
 /// <summary>
 /// Synchronize the state of the specified body part based on the observer's settings
 /// </summary>
 /// <remarks>
 /// <para>
 /// The status, layer, and context are synchronized, depending on the observer settings.  Other
 /// properties such as <see cref="BodyPartType"/>, transform values, etc., are not included.
 /// </para>
 /// </remarks>
 /// <param name="to">The body part to sync to. (Required)</param>
 /// <param name="from">The body part to sync from. (Required)</param>
 /// <param name="ignoreContext">
 /// The context that should never be synchronized. (Usually the <paramref name="from"/>'s GameObject.
 /// (Required if observer is configured to include context.)
 /// </param>
 public virtual void Synchronize(BodyPart to, BodyPart from, GameObject ignoreContext)
 {
     BodyPart.Synchronize(to, from, m_ColliderBehavior, m_ColliderLayer, m_Context, ignoreContext);
 }