Ejemplo n.º 1
0
        /// <summary>Appends the hierarchy path of this state through its <see cref="Parent"/>s.</summary>
        private static void AppendPath(StringBuilder path, AnimancerNode parent)
        {
            var parentState = parent as AnimancerState;

            if (parentState != null && parentState._Parent != null)
            {
                AppendPath(path, parentState._Parent);
            }
            else
            {
                path.Append("Layers[")
                .Append(parent.Layer.PortIndex)
                .Append("].States");
                return;
            }

            var state = parent as AnimancerState;

            if (state != null)
            {
                state.AppendPortAndType(path);
            }
            else
            {
                path.Append(" -> ")
                .Append(parent.GetType());
            }
        }
Ejemplo n.º 2
0
        /************************************************************************************************************************/

        /// <summary>If the `node` is fading, this methods logs a warning (Assert-Only) and cancels the fade.</summary>
        private static void Validate(AnimancerNode node)
        {
            if (node != null && node.FadeSpeed != 0)
            {
#if UNITY_ASSERTIONS
                Debug.LogWarning($"The following {node.GetType().Name} is fading even though " +
                                 $"{nameof(DontAllowFade)} is active: {node.GetDescription()}",
                                 node.Root.Component as Object);
#endif

                node.Weight = node.TargetWeight;
            }
        }