private void SetLeftHandItemAnimations(CharacterItemAnimator itemScript, ItemAnimationsObject itemAnimations, bool useBothHands) { SetLoopingConfigStanding(itemScript, itemAnimations.InteractionLeftLoop, itemAnimations.InteractionLeftStart, itemAnimations.InteractionLeftLoopTime); SetLoopingConfigCrouching(itemScript, itemAnimations.CrouchingInteractionLeftLoop, itemAnimations.CrouchingInteractionLeftStart, itemAnimations.CrouchingInteractionLeftLoopTime); SetInteractionAnimations(AnimationKey.Hand.Left, false, itemAnimations.InteractionLeftStart, itemAnimations.InteractionLeftLoop, itemAnimations.InteractionLeftEnd); SetInteractionAnimations(AnimationKey.Hand.Left, true, itemAnimations.CrouchingInteractionLeftStart, itemAnimations.CrouchingInteractionLeftLoop, itemAnimations.CrouchingInteractionLeftEnd); SetHoldingAnimations(AnimationKey.Hand.Left, itemAnimations.HoldingLeft, itemAnimations.CrouchingHoldingLeft, itemAnimations.EquipLeft, itemAnimations.UnEquipLeft); if (useBothHands) { SetInteractionAnimations(AnimationKey.Hand.Right, false, itemAnimations.InteractionLeftStart, itemAnimations.InteractionLeftLoop, itemAnimations.InteractionLeftEnd); SetInteractionAnimations(AnimationKey.Hand.Right, true, itemAnimations.CrouchingInteractionLeftStart, itemAnimations.CrouchingInteractionLeftLoop, itemAnimations.CrouchingInteractionLeftEnd); SetHoldingAnimations(AnimationKey.Hand.Both, itemAnimations.HoldingLeft, itemAnimations.CrouchingHoldingLeft, itemAnimations.EquipLeft, itemAnimations.UnEquipLeft); } }
public void SetCorrectAnimations(AnimatorOverrideController animator, ItemLogic itemInHandR, ItemLogic itemInHandL, CharacterItemAnimator itemScriptR, CharacterItemAnimator itemScriptL) { if (m_getOverridesCache == null) { m_getOverridesCache = new List <KeyValuePair <AnimationClip, AnimationClip> >(animator.overridesCount); } else { m_getOverridesCache.Clear(); } //TODO: These two can most likely be cached if we assume that the animator is still the same and overrides aren't modified by anything else animator.GetOverrides(m_getOverridesCache); PopulateOverrides(m_getOverridesCache); if (itemInHandR) { if (itemInHandR.ItemAnimations) { ItemAnimationsObject itemAnimations = itemInHandR.ItemAnimations; SetRightHandItemAnimations(itemScriptR, itemAnimations, itemInHandR.m_useBothHands); } else { ClearAnimations(AnimationKey.Hand.Right); } } if (itemInHandL) { if (itemInHandL.ItemAnimations) { ItemAnimationsObject itemAnimations = itemInHandL.ItemAnimations; SetLeftHandItemAnimations(itemScriptL, itemAnimations, itemInHandL.m_useBothHands); } else { ClearAnimations(AnimationKey.Hand.Left); } } animator.ApplyOverrides(new List <KeyValuePair <AnimationClip, AnimationClip> >(m_overrides.Values)); }
public void SetCorrectAnimations(AnimatorOverrideController animator, ItemLogic itemInHandR, ItemLogic itemInHandL, CharacterItemAnimator itemScriptR, CharacterItemAnimator itemScriptL) { if (m_getOverridesCache == null) { m_getOverridesCache = new List <KeyValuePair <AnimationClip, AnimationClip> >(animator.overridesCount); } else { m_getOverridesCache.Clear(); } animator.GetOverrides(m_getOverridesCache); PopulateOverrides(m_getOverridesCache); if (itemInHandR) { if (itemInHandR.ItemAnimations) { ItemAnimationsObject itemAnimations = itemInHandR.ItemAnimations; SetRightHandItemAnimations(itemScriptR, itemAnimations, itemInHandR.UseBothHands); } else { ClearAnimations(AnimationKey.Hand.Right); } } if (itemInHandL) { if (itemInHandL.ItemAnimations) { ItemAnimationsObject itemAnimations = itemInHandL.ItemAnimations; SetLeftHandItemAnimations(itemScriptL, itemAnimations, itemInHandL.UseBothHands); } else { ClearAnimations(AnimationKey.Hand.Left); } } animator.ApplyOverrides(new List <KeyValuePair <AnimationClip, AnimationClip> >(m_overrides.Values)); }