/// <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(ItemAnimationPriority priority, int layer) { var state = base.GetDestinationState(priority, layer); if (state != null) { return(state); } // Any animation called by the MeleeWeapon component is a high priority animation. if (priority == ItemAnimationPriority.High) { if (m_Recoil) { state = m_RecoilStates.GetState(layer, m_Controller.Moving); if (state != null) { return(state); } } } return(null); }
/// <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(ItemAnimationPriority priority, int layer) { var state = base.GetDestinationState(priority, layer); if (state != null) { return(state); } // Item use is a high priority item. if (priority == ItemAnimationPriority.High) { if (InUse()) { state = m_UseStates.GetState(layer, m_Controller.Moving); if (state != null) { return(state); } } } return(null); }
/// <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(ItemAnimationPriority priority, int layer) { // Secondary Items are not visible so cannot aim or play any idle/movement states. if (m_ItemType is SecondaryItemType) { return(null); } if (priority == ItemAnimationPriority.High) { // Equip/unequip has the highest priority. if (m_IsEquipping) { var equipState = m_EquipStates.GetState(layer, m_Controller.Moving); if (equipState != null) { return(equipState); } } if (m_IsUnequipping) { var unequipState = m_UnequipStates.GetState(layer, m_Controller.Moving); if (unequipState != null) { return(unequipState); } } // Extension item animations have a higher priority than aiming. for (int i = 0; i < m_ItemExtensions.Length; ++i) { var extensionState = m_ItemExtensions[i].GetDestinationState(priority, layer); if (extensionState != null) { return(extensionState); } } // No high priority animations need to play. Return null. return(null); } else if (priority == ItemAnimationPriority.Medium) { // Aiming is a middle priority animations. if (m_CanAim) { if (m_Controller.Aiming) { var aimstate = m_AimStates.GetState(layer, m_Controller.Moving); if (aimstate != null) { return(aimstate); } } } return(null); } // A lower priority animation can play. Play the ability, movement, or idle state. var state = m_DefaultStates.GetState(layer, m_Controller.Moving); if (state != null) { return(state); } return(null); }