Exemplo n.º 1
0
        protected float UpdateSpread(PlayerWeaponController controller, float accuracy)
        {
            SniperSpreadLogicConfig config = controller.HeldWeaponAgent.SniperSpreadLogicCfg;
            float param;
            var   posture = controller.RelatedStateInterface.GetCurrentPostureState();

            if (!controller.RelatedPlayerMove.IsGround)
            {
                param = config.AirParam;
            }
            else if (controller.RelatedPlayerMove.HorizontalVelocity > Length2D1)
            {
                param = config.LengthParam1;
            }
            else if (controller.RelatedPlayerMove.HorizontalVelocity > Length2D2)
            {
                param = config.LengthParam2;
            }
            else if (posture == XmlConfig.PostureInConfig.Crouch || posture == XmlConfig.PostureInConfig.Prone)
            {
                param = config.DuckParam;
            }
            else
            {
                param = config.DefaultParam;
            }
            if (!controller.RelatedCameraSNew.IsAiming())
            {
                param += config.FovAddParam;
            }
            return(param);
        }
Exemplo n.º 2
0
        public static float GetSpreadScaleFactor(SniperSpreadLogicConfig snipperSpreadLogicConfig,
                                                 WeaponAttackProxy attackProxy)
        {
            float param   = 0f;
            var   posture = attackProxy.CharacterState.GetCurrentPostureState();

            if (!attackProxy.PlayerMove.IsGround)
            {
                param = snipperSpreadLogicConfig.AirParam;
            }
            else if (attackProxy.PlayerMove.HorizontalVelocity > GlobalConst.Length2D1)
            {
                param = snipperSpreadLogicConfig.LengthParam1;
            }
            else if (attackProxy.PlayerMove.HorizontalVelocity > GlobalConst.Length2D2)
            {
                param = snipperSpreadLogicConfig.LengthParam2;
            }
            else if (posture == PostureInConfig.Crouch || posture == PostureInConfig.Prone)
            {
                param = snipperSpreadLogicConfig.DuckParam;
            }
            else
            {
                param = snipperSpreadLogicConfig.DefaultParam;
            }

            if (!attackProxy.IsAiming)
            {
                param += snipperSpreadLogicConfig.FovAddParam;
            }

            return(param);
        }
        protected override void Update(WeaponAttackProxy attackProxy, WeaponSideCmd cmd)
        {
            SniperSpreadLogicConfig config = attackProxy.WeaponConfigAssy.S_SniperSpreadLogicCfg;
            float spread = FireSpreadProvider.GetSpreadScaleFactor(config, attackProxy);

            FireSpreadFormula.ApplyFixedFinalSpread(spread, config.SpreadScale, attackProxy.RuntimeComponent);
        }
Exemplo n.º 4
0
        public static float GetSpreadScaleFactor(SniperSpreadLogicConfig snipperSpreadLogicConfig, PlayerWeaponController controller)
        {
            float param   = 0f;
            var   posture = controller.RelatedCharState.GetCurrentPostureState();

            if (!controller.RelatedPlayerMove.IsGround)
            {
                param = snipperSpreadLogicConfig.AirParam;
            }
            else if (controller.RelatedPlayerMove.HorizontalVelocity > GlobalConst.Length2D1)
            {
                param = snipperSpreadLogicConfig.LengthParam1;
            }
            else if (controller.RelatedPlayerMove.HorizontalVelocity > GlobalConst.Length2D2)
            {
                param = snipperSpreadLogicConfig.LengthParam2;
            }
            else if (posture == XmlConfig.PostureInConfig.Crouch || posture == XmlConfig.PostureInConfig.Prone)
            {
                param = snipperSpreadLogicConfig.DuckParam;
            }
            else
            {
                param = snipperSpreadLogicConfig.DefaultParam;
            }

            if (!controller.RelatedCameraSNew.IsAiming())
            {
                param += snipperSpreadLogicConfig.FovAddParam;
            }

            return(param);
        }
Exemplo n.º 5
0
        protected override void Update(WeaponBaseAgent weaponBaseAgent, WeaponSideCmd cmd)

        {
            SniperSpreadLogicConfig config = weaponBaseAgent.SniperSpreadLogicCfg;
            var   runTimeComponent         = weaponBaseAgent.RunTimeComponent;
            float spread = FireSpreadProvider.GetSpreadScaleFactor(config, weaponBaseAgent.Owner.WeaponController());

            FireSpreadFormula.ApplyFixedFinalSpread(spread, config.SpreadScale, runTimeComponent);
        }
Exemplo n.º 6
0
        public void BeforeFireBullet(PlayerWeaponController controller, IWeaponCmd cmd)
        {
            SniperSpreadLogicConfig config = controller.HeldWeaponAgent.SniperSpreadLogicCfg;
            var   weaponState = controller.HeldWeaponAgent.RunTimeComponent;
            float spread      = UpdateSpread(controller, weaponState.Accuracy);

            weaponState.LastSpreadX = spread * config.SpreadScale.ScaleX;
            weaponState.LastSpreadY = spread * config.SpreadScale.ScaleY;
        }