public Motion GetOverrideMotion(AnimatorState state)
 {
     if (this.m_Motions != null)
     {
         StateMotionPair[] motions = this.m_Motions;
         for (int i = 0; i < motions.Length; i++)
         {
             StateMotionPair stateMotionPair = motions[i];
             if (stateMotionPair.m_State == state)
             {
                 return(stateMotionPair.m_Motion);
             }
         }
     }
     return(null);
 }
Exemple #2
0
        public void                       SetOverrideMotion(AnimatorState state, Motion motion)
        {
            if (m_Motions == null)
            {
                m_Motions = new StateMotionPair[] {}
            }
            ;
            for (int i = 0; i < m_Motions.Length; ++i)
            {
                if (m_Motions[i].m_State == state)
                {
                    m_Motions[i].m_Motion = motion;
                    return;
                }
            }

            StateMotionPair newPair;

            newPair.m_State  = state;
            newPair.m_Motion = motion;
            ArrayUtility.Add(ref m_Motions, newPair);
        }