Exemple #1
0
        public void Update(CodeRigBoneParam param)
        {
            try
            {
                _mainInfo.BeginProfileOnlyEnableProfile();
                if (ThirdPersonIncluded)
                {
                    StableUpperBody(param.OverlayAnimationWeight, param.PostureWhenOverlay);
                    _ikControllerP3.SetIKActive(param.IKActive);
                }

                Peek(param.PeekAmplitude, param.IsSight);
                PitchP1(param.PitchAmplitude);

                if (FirstPersonIncluded)
                {
                    var parent = _characterP1.transform.parent;
                    try
                    {
                        _characterP1.transform.SetParent(null, false);
                        SetFirstPersonShift(CreateFirstPersonOffsetParam(param));
                        SetSightStatus(CreateSightStatusParam(param));
                        _ikControllerP1.SetIKActive(param.IKActive);
                    }
                    finally
                    {
                        _characterP1.transform.SetParent(parent, false);
                    }
                }
            }
            finally
            {
                _mainInfo.EndProfileOnlyEnableProfile();
            }
        }
Exemple #2
0
 private static FirstPersonOffsetParam CreateFirstPersonOffsetParam(CodeRigBoneParam param)
 {
     return(new FirstPersonOffsetParam
     {
         IsFirstPerson = param.IsFirstPerson,
         IsSight = param.IsSight,
         HorizontalShift = param.IsSight
             ? param.SightMoveHorizontalShift
             : param.FastMoveHorizontalShift,
         VerticalShift =
             param.IsSight ? param.SightMoveVerticalShift : param.FastMoveVerticalShift,
         FirstPersonPositionOffset = param.FirstPersonPositionOffset,
         FirstPersonRotationOffset = param.FirstPersonRotationOffset
     });
 }
Exemple #3
0
 private static SightStatusParam CreateSightStatusParam(CodeRigBoneParam param)
 {
     return(new SightStatusParam
     {
         IsFire = param.IsFire,
         IsSight = param.IsSight,
         IsIntoSight = param.IsIntoSight,
         PeekAmplitude = param.PeekAmplitude,
         SightOffset = param.SightOffset,
         PitchAmplitude = param.PitchAmplitude,
         SightProgress = param.SightProgress,
         SightHorizontalShift = param.SightHorizontalShift /* * param.SightShiftBuff*/,
         SightVerticalShift = param.SightVerticalShift /* * param.SightShiftBuff*/,
         FirstPersonSightOffset = param.FirstPersonSightOffset,
         ScopeOffset = param.ScopeOffset,
         SightModelOffset = param.SightModelOffset
     });
 }