示例#1
0
 private void applyIK()
 {
     if (propUser == null)
     {
         propUser = GetComponent <PropUser>();
         if (propUser == null)
         {
             return;
         }
     }
     if (curPropGO == null)
     {
         if (propUser.Prop != null)
         {
             resetIK(propUser.Prop.gameObject);
         }
         else
         {
             InvitationalItemController componentInChildren = GetComponentInChildren <InvitationalItemController>();
             if (componentInChildren != null)
             {
                 curPropGO = componentInChildren.gameObject;
                 resetIK(curPropGO);
             }
         }
     }
     if (curPropGO == null && isHoldingProp)
     {
         AnimatorStateInfo currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(1);
         if (!LocomotionUtils.IsUsing(currentAnimatorStateInfo))
         {
             resetIK(null);
         }
     }
     if (propIK != null && ikBones.Count > 0)
     {
         AnimatorStateInfo animatorStateInfo = LocomotionUtils.GetAnimatorStateInfo(animator);
         for (int i = 0; i < ikBones.Count; i++)
         {
             if (swim.IsInShallowWater)
             {
                 if (LocomotionUtils.IsIdling(animatorStateInfo))
                 {
                     ikBones[i].TargetAngle = propIK.IKModifiers[i].IdleZRot;
                 }
                 else
                 {
                     ikBones[i].TargetAngle = propIK.IKModifiers[i].SwimMoveZRot;
                 }
             }
             else if (LocomotionUtils.IsIdling(animatorStateInfo))
             {
                 ikBones[i].TargetAngle = propIK.IKModifiers[i].IdleZRot;
             }
             else
             {
                 ikBones[i].TargetAngle = propIK.IKModifiers[i].DiveMoveZRot;
             }
         }
     }
     blendIK();
 }