コード例 #1
0
        private void BoneUpdate(PlayerEntity player)
        {
            var appearanceP1  = player.appearanceInterface.FirstPersonAppearance;
            var characterBone = player.characterBoneInterface.CharacterBone;

            _fsmOutputs.ResetOutput();
            characterBone.Execute(_fsmOutputs.AddOutput);
            _fsmOutputs.SetOutput(player);

            if (!SharedConfig.IsServer)
            {
                FollowRotHelper.Player = player;
                var rotParam = new FollowRotParam
                {
                    CameraFreeYaw     = player.cameraStateNew.FreeYaw,
                    CameraFreeNowMode = player.cameraStateNew.FreeNowMode,
                    CameraEulerAngle  = player.cameraFinalOutputNew.EulerAngle,
                    ClientTime        = player.time.ClientTime
                };
                characterBone.PreUpdate(rotParam, player.characterBoneInterface.CharacterBone);
                characterBone.SyncTo(player.characterBone);
            }

            var animator    = player.thirdPersonAnimator.UnityAnimator;
            var state       = player.stateInterface.State;
            var postureType = ThirdPersonAppearanceUtils.GetPosture(state);
            var action      = player.stateInterface.State.GetActionState();
            var keepAction  = player.stateInterface.State.GetActionKeepState();
            var posture     = player.stateInterface.State.GetCurrentPostureState();

            CodeRigBoneParam param = new CodeRigBoneParam
            {
                PitchAmplitude         = player.orientation.Pitch - player.orientation.WeaponPunchPitch * 2,
                OverlayAnimationWeight = animator.GetLayerWeight(NetworkAnimatorLayer.PlayerUpperBodyOverlayLayer),
                PostureWhenOverlay     = postureType,
                IsSight = state.GetActionKeepState() == ActionKeepInConfig.Sight || state.GetNextActionKeepState() == ActionKeepInConfig.Sight,
                SightHorizontalShift = appearanceP1.SightShift.Buff * player.firstPersonAppearance.SightHorizontalShift,
                SightVerticalShift   = appearanceP1.SightShift.Buff * player.firstPersonAppearance.SightVerticalShift,
                SightShiftBuff       = player.oxygenEnergyInterface.Oxygen.SightShiftBuff,
                IKActive             = IKFilter.FilterPlayerIK(action, keepAction, posture),
                HeadPitch            = player.characterBone.PitchHeadAngle,
                HeadYaw        = player.characterBone.RotHeadAngle,
                HandPitch      = player.characterBone.PitchHandAngle,
                HeadRotProcess = player.characterBone.HeadRotProcess,
                IsHeadRotCW    = player.characterBone.IsHeadRotCW,
                WeaponPitch    = player.characterBone.WeaponPitch,
                IsServer       = SharedConfig.IsServer
            };

            characterBone.Update(param);
            if (!SharedConfig.IsServer)
            {
                characterBone.WeaponRotUpdate(param);
            }
        }
コード例 #2
0
        private void BoneUpdate(PlayerEntity player)
        {
            var characterBone = player.characterBoneInterface.CharacterBone;

            _fsmOutputs.ResetOutput();
            characterBone.Execute(_fsmOutputs.AddOutput);
            _fsmOutputs.SetOutput(player);

            if (!SharedConfig.IsServer)
            {
                FollowRotHelper.Player = player;
                var rotParam = new FollowRotParam
                {
                    CameraFreeYaw     = player.cameraStateNew.FreeYaw,
                    CameraFreeNowMode = player.cameraStateNew.FreeNowMode,
                    CameraEulerAngle  = player.cameraFinalOutputNew.EulerAngle,
                    ClientTime        = player.time.ClientTime
                };
                characterBone.PreUpdate(rotParam, player.characterBoneInterface.CharacterBone, _deltaTime);
                characterBone.SyncTo(player.characterBone);
            }

            var animator    = player.thirdPersonAnimator.UnityAnimator;
            var state       = player.stateInterface.State;
            var action      = player.stateInterface.State.GetActionState();
            var nextAction  = player.stateInterface.State.GetNextActionState();
            var keepAction  = player.stateInterface.State.GetActionKeepState();
            var posture     = player.stateInterface.State.GetCurrentPostureState();
            var nextPosture = player.stateInterface.State.GetNextPostureState();
            var movement    = player.stateInterface.State.GetCurrentMovementState();
            var postureType = ThirdPersonAppearanceUtils.GetPosture(posture);

            UpdateOffsetData(player);

            var param = new CodeRigBoneParam
            {
                PitchAmplitude         = player.orientation.Pitch - player.orientation.AccPunchPitchValue * 2,
                OverlayAnimationWeight = animator.GetLayerWeight(NetworkAnimatorLayer.PlayerUpperBodyOverlayLayer),
                PostureWhenOverlay     = postureType,
                IsSight              = state.GetActionKeepState() == ActionKeepInConfig.Sight || state.GetNextActionKeepState() == ActionKeepInConfig.Sight,
                IsIntoSight          = state.GetNextActionKeepState() == ActionKeepInConfig.Sight,
                SightHorizontalShift = /*appearanceP1.SightShift.Buff * */ player.firstPersonAppearance.SightHorizontalShift,
                SightVerticalShift   = /*appearanceP1.SightShift.Buff * */ player.firstPersonAppearance.SightVerticalShift,
                SightShiftBuff       = player.oxygenEnergyInterface.Oxygen.SightShiftBuff,
                IKActive             = IKFilter.FilterPlayerIk(action, nextAction, keepAction, posture, nextPosture, movement),
                HeadPitch            = player.characterBone.PitchHeadAngle,
                HeadYaw              = player.characterBone.RotHeadAngle,
                CurrentHandPitch     = player.characterBone.CurrentPitchHandAngle,
                WeaponRot            = player.characterBone.WeaponRot,
                IsFire   = action == ActionInConfig.Fire,
                IsServer = SharedConfig.IsServer,

                FirstPersonPositionOffset = player.characterBone.FirstPersonPositionOffset,
                FirstPersonRotationOffset = player.characterBone.FirstPersonRotationOffset,
                FirstPersonSightOffset    = player.characterBone.FirstPersonSightOffset
            };

            //     DebugUtil.MyLog("SightVerticalShift:"+param.SightVerticalShift + "||SightVerticalShift:"+param.SightVerticalShift);

            if (!SharedConfig.IsServer)
            {
                characterBone.WeaponRotUpdate(param, _deltaTime);
            }
            else
            {
                characterBone.WeaponRotPlayback(param);
            }
            characterBone.Update(param);
        }