/************************************************************************************************************************/ /// <summary>Disconnects the `state` from this layer at its <see cref="AnimancerNode.Index"/>.</summary> protected internal override void OnRemoveChild(AnimancerState state) { var index = state.Index; Validate.RemoveChild(state, States); if (_Playable.GetInput(index).IsValid()) { Root._Graph.Disconnect(_Playable, index); } // Swap the last state into the place of the one that was just removed. var lastPort = States.Count - 1; if (index < lastPort) { state = States[lastPort]; state.DisconnectFromGraph(); States[index] = state; state.Index = index; if (KeepChildrenConnected || state.Weight != 0) { state.ConnectToGraph(); } } States.RemoveAt(lastPort); _Playable.SetInputCount(lastPort); }
/// <summary>Disconnects the `state` from this mixer at its <see cref="AnimancerNode.Index"/>.</summary> protected internal override void OnRemoveChild(AnimancerState state) { Validate.RemoveChild(state, States); States[state.Index] = null; state.DisconnectFromGraph(); }