Example #1
0
        /// <summary>
        /// Tries to change to the state for each equipped item.
        /// </summary>
        /// <param name="priority">Specifies the item animation priority to retrieve.</param>
        /// <param name="layer">The current animator layer.</param>
        /// <param name="normalizedTime">The normalized time to start playing the animation state.</param>
        /// <param name="stateChange">True if the state was changed.</param>
        /// <returns>The state that the Animator should changed to. Note that this state may be the same as the previous state so no changes may be necessary.</returns>
        private AnimatorItemStateData HasItemState(Item.ItemAnimationPriority priority, int layer, float normalizedTime, bool changeStates, out bool stateChange)
        {
            stateChange = false;
            // The Inventory may not be attached.
            if (m_ItemName == null)
            {
                return(null);
            }

            AnimatorItemStateData state;

            if ((state = HasItemState(priority, layer, normalizedTime, m_CurrentPrimaryItem.Get(), changeStates, ref stateChange)) != null)
            {
                return(state);
            }
            if ((state = HasItemState(priority, layer, normalizedTime, m_CurrentDualWieldItem.Get(), changeStates, ref stateChange)) != null)
            {
                return(state);
            }
            // The SecondayItemType can only respond to high priority state changes.
            if (priority == Item.ItemAnimationPriority.High)
            {
                if ((state = HasItemState(priority, layer, normalizedTime, m_CurrentSecondaryItem.Get(), changeStates, ref stateChange)) != null)
                {
                    return(state);
                }
            }
            return(null);
        }
Example #2
0
 /// <summary>
 /// Tries to change to the state requested by the specified item.
 /// </summary>
 /// <param name="priority">Specifies the item animation priority to retrieve.</param>
 /// <param name="layer">The current animator layer.</param>
 /// <param name="normalizedTime">The normalized time to start playing the animation state.</param>
 /// <param name="item">The item which could change the Animator states.</param>
 /// <param name="changeStates">Should the state actually be changed?</param>
 /// <param name="stateChange">True if the state was changed.</param>
 /// <returns>The state that the Animator should changed to. Note that this state may be the same as the previous state so no changes may be necessary.</returns>
 private AnimatorItemStateData HasItemState(Item.ItemAnimationPriority priority, int layer, float normalizedTime, Item item, bool changeStates, ref bool stateChange)
 {
     if (item != null)
     {
         var state = item.GetDestinationState(priority, layer);
         if (state != null)
         {
             if (changeStates)
             {
                 stateChange = ChangeItemState(state, layer, normalizedTime);
             }
         }
         return(state);
     }
     return(null);
 }
Example #3
0
        /// <summary>
        /// Returns the destination state for the given layer.
        /// </summary>
        /// <param name="priority">Specifies the item animation priority to retrieve. High priority animations get tested before lower priority animations.</param>
        /// <param name="layer">The Animator layer index.</param>
        /// <returns>The state that the Animator should be in for the given layer. A null value indicates no change.</returns>
        public override AnimatorItemStateData GetDestinationState(Item.ItemAnimationPriority priority, int layer)
        {
            var state = base.GetDestinationState(priority, layer);

            if (state != null)
            {
                return(state);
            }

            // Any animation called by the MeleeWeaponExtension component is a high priority animation.
            if (priority == Item.ItemAnimationPriority.High)
            {
                if (m_Recoil)
                {
                    state = m_RecoilStates.GetState(layer, m_Controller.Moving);
                    if (state != null)
                    {
                        return(state);
                    }
                }
            }

            return(null);
        }
Example #4
0
 /// <summary>
 /// Returns the destination state for the given layer.
 /// </summary>
 /// <param name="priority">Specifies the item animation priority to retrieve. High priority animations get tested before lower priority animations.</param>
 /// <param name="layer">The Animator layer index.</param>
 /// <returns>The state that the Animator should be in for the given layer. A null value indicates no change.</returns>
 public virtual AnimatorItemStateData GetDestinationState(Item.ItemAnimationPriority priority, int layer)
 {
     return(null);
 }