Пример #1
0
        /// <summary>
        /// Connects this state to the 'parent' mixer at the specified 'portIndex'.
        /// <para></para>
        /// See also <see cref="AnimancerLayer.AddChild(AnimancerState)"/> to connect a state to an available port on a
        /// layer.
        /// </summary>
        public void SetParent(AnimancerNode parent, int portIndex)
        {
            if (_Parent != null)
            {
                _Parent.OnRemoveChild(this);
            }

            PortIndex = portIndex;
            _Parent   = parent;
            SetWeightDirty();

            if (parent != null)
            {
                parent.OnAddChild(this);
            }
        }
Пример #2
0
        /// <summary>Connects this state to the `parent` mixer at the specified `index`.</summary>
        /// <remarks>
        /// Use <see cref="AnimancerLayer.AddChild(AnimancerState)"/> instead of this method to connect a state to an
        /// available port on a layer.
        /// </remarks>
        public void SetParent(AnimancerNode parent, int index)
        {
            if (_Parent != null)
            {
                _Parent.OnRemoveChild(this);
                _Parent = null;
            }

            if (parent == null)
            {
                Index = -1;
                return;
            }

            SetRoot(parent.Root);
            Index   = index;
            _Parent = parent;
            parent.OnAddChild(this);
            CopyIKFlags(parent);
        }