Beispiel #1
0
 /// <summary>
 ///   <para>Utility function to remove an entry transition from the state machine.</para>
 /// </summary>
 /// <param name="transition">The transition to remove.</param>
 public bool RemoveEntryTransition(AnimatorTransition transition)
 {
     // ISSUE: object of a compiler-generated type is created
     // ISSUE: variable of a compiler-generated type
     AnimatorStateMachine.\u003CRemoveEntryTransition\u003Ec__AnonStorey19 transitionCAnonStorey19 = new AnimatorStateMachine.\u003CRemoveEntryTransition\u003Ec__AnonStorey19();
     // ISSUE: reference to a compiler-generated field
     transitionCAnonStorey19.transition = transition;
     // ISSUE: reference to a compiler-generated method
     if (!new List <AnimatorTransition>((IEnumerable <AnimatorTransition>) this.entryTransitions).Any <AnimatorTransition>(new Func <AnimatorTransition, bool>(transitionCAnonStorey19.\u003C\u003Em__21)))
     {
         return(false);
     }
     this.undoHandler.DoUndo((UnityEngine.Object) this, "Entry Transition Removed");
     AnimatorTransition[] entryTransitions = this.entryTransitions;
     // ISSUE: reference to a compiler-generated field
     ArrayUtility.Remove <AnimatorTransition>(ref entryTransitions, transitionCAnonStorey19.transition);
     this.entryTransitions = entryTransitions;
     // ISSUE: reference to a compiler-generated field
     if (MecanimUtilities.AreSameAsset((UnityEngine.Object) this, (UnityEngine.Object)transitionCAnonStorey19.transition))
     {
         // ISSUE: reference to a compiler-generated field
         Undo.DestroyObjectImmediate((UnityEngine.Object)transitionCAnonStorey19.transition);
     }
     return(true);
 }
        public static bool StateMachineRelativePath(AnimatorStateMachine parent, AnimatorStateMachine toFind, ref List <AnimatorStateMachine> hierarchy)
        {
            hierarchy.Add(parent);
            bool result;

            if (parent == toFind)
            {
                result = true;
            }
            else
            {
                ChildAnimatorStateMachine[] childStateMachines = AnimatorStateMachine.StateMachineCache.GetChildStateMachines(parent);
                for (int i = 0; i < childStateMachines.Length; i++)
                {
                    if (MecanimUtilities.StateMachineRelativePath(childStateMachines[i].stateMachine, toFind, ref hierarchy))
                    {
                        result = true;
                        return(result);
                    }
                }
                hierarchy.Remove(parent);
                result = false;
            }
            return(result);
        }
 public void RemoveTransition(AnimatorStateTransition transition)
 {
     this.undoHandler.DoUndo(this, "Transition removed");
     AnimatorStateTransition[] transitions = this.transitions;
     ArrayUtility.Remove <AnimatorStateTransition>(ref transitions, transition);
     this.transitions = transitions;
     if (MecanimUtilities.AreSameAsset(this, transition))
     {
         Undo.DestroyObjectImmediate(transition);
     }
 }
 internal static void DestroyBlendTreeRecursive(BlendTree blendTree)
 {
     for (int i = 0; i < blendTree.children.Length; i++)
     {
         BlendTree blendTree2 = blendTree.children[i].motion as BlendTree;
         if (blendTree2 != null && MecanimUtilities.AreSameAsset(blendTree, blendTree2))
         {
             MecanimUtilities.DestroyBlendTreeRecursive(blendTree2);
         }
     }
     Undo.DestroyObjectImmediate(blendTree);
 }
 internal static void DestroyBlendTreeRecursive(BlendTree blendTree)
 {
     for (int index = 0; index < blendTree.children.Length; ++index)
     {
         BlendTree motion = blendTree.children[index].motion as BlendTree;
         if ((Object)motion != (Object)null && MecanimUtilities.AreSameAsset((Object)blendTree, (Object)motion))
         {
             MecanimUtilities.DestroyBlendTreeRecursive(motion);
         }
     }
     Undo.DestroyObjectImmediate((Object)blendTree);
 }
 /// <summary>
 ///   <para>Utility function to remove a transition from the state.</para>
 /// </summary>
 /// <param name="transition">Transition to remove.</param>
 public void RemoveTransition(AnimatorStateTransition transition)
 {
     this.undoHandler.DoUndo((UnityEngine.Object) this, "Transition removed");
     AnimatorStateTransition[] transitions = this.transitions;
     ArrayUtility.Remove <AnimatorStateTransition>(ref transitions, transition);
     this.transitions = transitions;
     if (!MecanimUtilities.AreSameAsset((UnityEngine.Object) this, (UnityEngine.Object)transition))
     {
         return;
     }
     Undo.DestroyObjectImmediate((UnityEngine.Object)transition);
 }
Beispiel #7
0
 private void RemoveLayerInternal(int index, ref AnimatorControllerLayer[] layerVector)
 {
     if (layerVector[index].syncedLayerIndex == -1 && layerVector[index].stateMachine != null)
     {
         this.undoHandler.DoUndo(layerVector[index].stateMachine, "Layer removed");
         layerVector[index].stateMachine.Clear();
         if (MecanimUtilities.AreSameAsset(this, layerVector[index].stateMachine))
         {
             Undo.DestroyObjectImmediate(layerVector[index].stateMachine);
         }
     }
     ArrayUtility.Remove <AnimatorControllerLayer>(ref layerVector, layerVector[index]);
 }
Beispiel #8
0
        public bool RemoveStateMachineTransition(AnimatorStateMachine sourceStateMachine, AnimatorTransition transition)
        {
            this.undoHandler.DoUndo(this, "StateMachine Transition Removed");
            AnimatorTransition[] stateMachineTransitions = this.GetStateMachineTransitions(sourceStateMachine);
            int num = stateMachineTransitions.Length;

            ArrayUtility.Remove <AnimatorTransition>(ref stateMachineTransitions, transition);
            this.SetStateMachineTransitions(sourceStateMachine, stateMachineTransitions);
            if (MecanimUtilities.AreSameAsset(this, transition))
            {
                Undo.DestroyObjectImmediate(transition);
            }
            return(num != stateMachineTransitions.Length);
        }
Beispiel #9
0
        /// <summary>
        ///   <para>Utility function to remove an outgoing transition from source state machine.</para>
        /// </summary>
        /// <param name="transition">The transition to remove.</param>
        /// <param name="sourceStateMachine">The source state machine.</param>
        public bool RemoveStateMachineTransition(AnimatorStateMachine sourceStateMachine, AnimatorTransition transition)
        {
            this.undoHandler.DoUndo((UnityEngine.Object) this, "StateMachine Transition Removed");
            AnimatorTransition[] machineTransitions = this.GetStateMachineTransitions(sourceStateMachine);
            int length = machineTransitions.Length;

            ArrayUtility.Remove <AnimatorTransition>(ref machineTransitions, transition);
            this.SetStateMachineTransitions(sourceStateMachine, machineTransitions);
            if (MecanimUtilities.AreSameAsset((UnityEngine.Object) this, (UnityEngine.Object)transition))
            {
                Undo.DestroyObjectImmediate((UnityEngine.Object)transition);
            }
            return(length != machineTransitions.Length);
        }
Beispiel #10
0
 public bool RemoveEntryTransition(AnimatorTransition transition)
 {
     if (new List <AnimatorTransition>(this.entryTransitions).Any((AnimatorTransition t) => t == transition))
     {
         this.undoHandler.DoUndo(this, "Entry Transition Removed");
         AnimatorTransition[] entryTransitions = this.entryTransitions;
         ArrayUtility.Remove <AnimatorTransition>(ref entryTransitions, transition);
         this.entryTransitions = entryTransitions;
         if (MecanimUtilities.AreSameAsset(this, transition))
         {
             Undo.DestroyObjectImmediate(transition);
         }
         return(true);
     }
     return(false);
 }
 public static bool StateMachineRelativePath(AnimatorStateMachine parent, AnimatorStateMachine toFind, ref List <AnimatorStateMachine> hierarchy)
 {
     hierarchy.Add(parent);
     if ((Object)parent == (Object)toFind)
     {
         return(true);
     }
     for (int index = 0; index < parent.stateMachines.Length; ++index)
     {
         if (MecanimUtilities.StateMachineRelativePath(parent.stateMachines[index].stateMachine, toFind, ref hierarchy))
         {
             return(true);
         }
     }
     hierarchy.Remove(parent);
     return(false);
 }
        public bool RemoveStateMachineTransition(AnimatorStateMachine sourceStateMachine, AnimatorTransition transition)
        {
            undoHandler.DoUndo(this, "StateMachine Transition Removed");

            AnimatorTransition[] transitionsVector = GetStateMachineTransitions(sourceStateMachine);
            int baseSize = transitionsVector.Length;

            ArrayUtility.Remove(ref transitionsVector, transition);
            SetStateMachineTransitions(sourceStateMachine, transitionsVector);

            if (MecanimUtilities.AreSameAsset(this, transition))
            {
                Undo.DestroyObjectImmediate(transition);
            }

            return(baseSize != transitionsVector.Length);
        }
        public bool RemoveEntryTransition(AnimatorTransition transition)
        {
            if ((new List <AnimatorTransition>(entryTransitions)).Any(t => t == transition))
            {
                undoHandler.DoUndo(this, "Entry Transition Removed");
                AnimatorTransition[] transitionsVector = entryTransitions;
                ArrayUtility.Remove(ref transitionsVector, transition);
                entryTransitions = transitionsVector;

                if (MecanimUtilities.AreSameAsset(this, transition))
                {
                    Undo.DestroyObjectImmediate(transition);
                }

                return(true);
            }

            return(false);
        }
Beispiel #14
0
        public bool RemoveAnyStateTransition(AnimatorStateTransition transition)
        {
            bool result;

            if (new List <AnimatorStateTransition>(this.anyStateTransitions).Any((AnimatorStateTransition t) => t == transition))
            {
                this.undoHandler.DoUndo(this, "AnyState Transition Removed");
                AnimatorStateTransition[] anyStateTransitions = this.anyStateTransitions;
                ArrayUtility.Remove <AnimatorStateTransition>(ref anyStateTransitions, transition);
                this.anyStateTransitions = anyStateTransitions;
                if (MecanimUtilities.AreSameAsset(this, transition))
                {
                    Undo.DestroyObjectImmediate(transition);
                }
                result = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }
 public void RemoveLayer(int index)
 {
     this.undoHandler.DoUndo(this, "Layer removed");
     AnimatorControllerLayer[] layers = this.layers;
     if (layers[index].syncedLayerIndex == -1 && layers[index].stateMachine != null)
     {
         layers[index].stateMachine.Clear();
         if (MecanimUtilities.AreSameAsset(this, layers[index].stateMachine))
         {
             Undo.DestroyObjectImmediate(layers[index].stateMachine);
         }
     }
     AnimatorControllerLayer[] array = layers;
     for (int i = 0; i < array.Length; i++)
     {
         AnimatorControllerLayer animatorControllerLayer = array[i];
         if (animatorControllerLayer.syncedLayerIndex == index)
         {
             animatorControllerLayer.syncedLayerIndex = -1;
         }
     }
     ArrayUtility.Remove <AnimatorControllerLayer>(ref layers, layers[index]);
     this.layers = layers;
 }