Пример #1
0
        /************************************************************************************************************************/

        /// <summary>[Pro-Only]
        /// Calculates all thresholds in the `mixer` using the <see cref="AnimancerState.AverageVelocity"/> of each
        /// state on the X and Z axes.
        /// <para></para>
        /// Note that this method requires the <c>Root Transform Position (XZ) -> Bake Into Pose</c> toggle to be
        /// disabled in the Import Settings of each <see cref="AnimationClip"/> in the mixer.
        /// </summary>
        public static void CalculateThresholdsFromAverageVelocityXZ(this MixerState <Vector2> mixer)
        {
            mixer.ValidateThresholdCount();

            for (int i = mixer.ChildCount - 1; i >= 0; i--)
            {
                var state = mixer.GetChild(i);
                if (state == null)
                {
                    continue;
                }

                var averageVelocity = state.AverageVelocity;
                mixer.SetThreshold(i, new Vector2(averageVelocity.x, averageVelocity.z));
            }
        }
Пример #2
0
        /************************************************************************************************************************/

        /// <summary>[Pro-Only]
        /// Calculates all thresholds using the <see cref="Motion.averageSpeed"/> of each state.
        /// </summary>
        public static void CalculateThresholdsFromAverageVelocityXZ(this MixerState <Vector2> mixer)
        {
            mixer.ValidateThresholdCount();

            var count = mixer.States.Length;

            for (int i = 0; i < count; i++)
            {
                var state = mixer.States[i];
                if (state == null)
                {
                    continue;
                }

                var averageVelocity = state.AverageVelocity;
                mixer.SetThreshold(i, new Vector2(averageVelocity.x, averageVelocity.z));
            }
        }