protected virtual void CreateFireRelatedEffect(WeaponAttackProxy attackProxy, ICharacterBone bones)

        {
            if (DefaultCfg.Spark < 1)
            {
                return;
            }
            var muzzleTrans = bones.GetLocation(SpecialLocation.MuzzleEffectPosition,
                                                attackProxy.Appearence.IsFirstPerson ? CharacterView.FirstPerson : CharacterView.ThirdPerson);
            var ejectTrans = bones.GetLocation(SpecialLocation.EjectionLocation,
                                               attackProxy.Appearence.IsFirstPerson ? CharacterView.FirstPerson : CharacterView.ThirdPerson);

            bool hasMuzzleEfc  = muzzleTrans && DefaultCfg.Spark > 0 && attackProxy.Owner.HeldWeaponAgent.HasSpark;
            bool hasBulletDrop = ejectTrans && DefaultCfg.BulletDrop > 0;

            if (hasMuzzleEfc)
            {
                ClientEffectFactory.CreateMuzzleSparkEffct(muzzleTrans.position, attackProxy.Orientation.Yaw,
                                                           attackProxy.Orientation.Pitch, DefaultCfg.Spark, muzzleTrans);
            }
            if (hasBulletDrop)
            {
                ClientEffectFactory.CreateBulletDrop(ejectTrans.position, attackProxy.Orientation.Yaw,
                                                     attackProxy.Orientation.Pitch, DefaultCfg.BulletDrop, attackProxy.WeaponConfigAssy.S_Id,
                                                     attackProxy.AudioController.GetFootMatType());
            }
        }
        private void CreateBulletEffect(WeaponAttackProxy attackProxy, ICharacterBone bones)
        {
            if (DefaultCfg.BulletFly < 1 || attackProxy.IsAiming)
            {
                return;
            }
            var muzzleTrans = bones.GetLocation(SpecialLocation.MuzzleEffectPosition,
                                                attackProxy.Appearence.IsFirstPerson ? CharacterView.FirstPerson : CharacterView.ThirdPerson);

            if (!muzzleTrans)
            {
                return;
            }
            var efcCommonCfg = SingletonManager.Get <ClientEffectCommonConfigManager>()
                               .GetConfigByType(EEffectObjectClassify.BulletFly);

            foreach (var bulletData in attackProxy.Owner.BulletList)
            {
                var origin   = bulletData.ViewPosition;
                var velocity = efcCommonCfg.Velocity * bulletData.Dir;

                Vector3 target = origin + velocity * 1.0f;
                Vector3 bulletEffectVelocity = (target - bulletData.EmitPosition) / 1.0f;
                ClientEffectFactory.CreateBulletFlyEffect(attackProxy.Owner.Owner, muzzleTrans.position,
                                                          muzzleTrans.rotation, bulletEffectVelocity, DefaultCfg.BulletFly, efcCommonCfg.Delay);
            }
        }
Пример #3
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);
        }
Пример #4
0
 //public override string ToString()
 //{
 //    //string s = "";
 //    //foreach(WeaponBagContainer val in playerWeaponAgent.BagSetCache.WeaponBags)
 //    //{
 //    //    s += val.ToString();
 //    //}
 //    ////return s;
 //}
 public PlayerWeaponController()
 {
     processHelper    = new WeaponProcessHelper(this);
     slotWeaponAgents = new WeaponBaseAgent[GlobalConst.WeaponSlotMaxLength];
     attackProxy      = new WeaponAttackProxy(this);
     //     interruptUpdateHandler = new InterruptUpdateHandler(this);
 }
Пример #5
0
        ///精准系数*精准值
        public static float GetSpreadScaleFactor(RifleSpreadLogicConfig rifleSpreadLogicConfig,
                                                 WeaponAttackProxy attackProxy)
        {
            Spread spreadAimCfg = attackProxy.IsAiming ? rifleSpreadLogicConfig.Aiming : rifleSpreadLogicConfig.Default;
            var    spreadFactor = GetSpreadFactor(spreadAimCfg, rifleSpreadLogicConfig.FastMoveSpeed, attackProxy);

            return(spreadFactor * spreadAimCfg.Base *
                   (1 - attackProxy.GetAttachedAttributeByType(WeaponAttributeType.Spread) / 100));
        }
        public void OnAfterFire(WeaponAttackProxy attackProxy, WeaponSideCmd cmd)
        {
            if (DefaultCfg == null)
            {
                return;
            }
            var bones = attackProxy.Owner.RelatedBones;

            CreateFireRelatedEffect(attackProxy, bones);
            CreateBulletEffect(attackProxy, bones);
        }
Пример #7
0
        public static ShakeInfoStruct GetFireUpDirShakeArgs(WeaponAttackProxy attackProxy, ShakeInfo shakeInfo)
        {
            var newInfo = (ShakeInfoStruct)shakeInfo;

            float factor = attackProxy.GetAttachedAttributeByType(WeaponAttributeType.UpBase);

            if (factor != 0f)
            {
                newInfo.UpBase *= factor;
            }
            //    logger.Info("Shoot Shake factor:"+factor);

            factor = attackProxy.GetAttachedAttributeByType(WeaponAttributeType.UpMax);
            if (factor != 0f)
            {
                newInfo.UpMax *= factor;
            }

            factor = attackProxy.GetAttachedAttributeByType(WeaponAttributeType.UpModifier);
            if (factor != 0f)
            {
                newInfo.UpModifier *= factor;
            }

            factor = attackProxy.GetAttachedAttributeByType(WeaponAttributeType.LateralBase);
            if (factor != 0f)
            {
                newInfo.LateralBase *= factor;
            }

            factor = attackProxy.GetAttachedAttributeByType(WeaponAttributeType.LateralMax);
            if (factor != 0f)
            {
                newInfo.LateralMax *= factor;
            }

            factor = attackProxy.GetAttachedAttributeByType(WeaponAttributeType.LateralModifier);
            if (factor != 0f)
            {
                newInfo.LateralModifier *= factor;
            }

            factor = attackProxy.GetAttachedAttributeByType(WeaponAttributeType.LateralTurnback);
            if (factor != 0f)
            {
                newInfo.LateralTurnback *= factor;
            }

            return(newInfo);
        }
Пример #8
0
        private static float GetSpreadFactor(PistolSpreadLogicConfig pistolSpreadLogicConfig,
                                             WeaponAttackProxy attackProxy)
        {
            float param   = pistolSpreadLogicConfig.DefaultParam;
            var   posture = attackProxy.CharacterState.GetCurrentPostureState();

            if (!attackProxy.PlayerMove.IsGround)
            {
                param = pistolSpreadLogicConfig.AirParam;
            }
            else if (attackProxy.PlayerMove.HorizontalVelocity > 13)
            {
                param = pistolSpreadLogicConfig.LengthGreater13Param;
            }
            else if (posture == PostureInConfig.Prone || posture == PostureInConfig.Crouch)
            {
                param = pistolSpreadLogicConfig.DuckParam;
            }

            return(param);
        }
Пример #9
0
        protected override void CreateFireRelatedEffect(WeaponAttackProxy attackProxy, ICharacterBone bones)
        {
            if (DefaultCfg.Spark < 1)
            {
                return;
            }
            var muzzleTrans = bones.GetLocation(SpecialLocation.MuzzleEffectPosition,
                                                attackProxy.Appearence.IsFirstPerson ? CharacterView.FirstPerson : CharacterView.ThirdPerson);
            var ejectTrans = bones.GetLocation(SpecialLocation.EjectionLocation,
                                               attackProxy.Appearence.IsFirstPerson ? CharacterView.FirstPerson : CharacterView.ThirdPerson);
            bool hasMuzzleEfc  = null != muzzleTrans && DefaultCfg.Spark > 0 && attackProxy.Owner.HeldWeaponAgent.HasSpark;
            bool hasBulletDrop = null != ejectTrans && DefaultCfg.BulletDrop > 0;

            if (!hasMuzzleEfc && !hasBulletDrop)
            {
                return;
            }
            FireEvent.FireEffectType fireEffectType = FireEvent.FireEffectType.Both;
            if (!hasMuzzleEfc)
            {
                fireEffectType = FireEvent.FireEffectType.EnjectOnly;
            }
            if (!hasBulletDrop)
            {
                fireEffectType = FireEvent.FireEffectType.MuzzleOnly;
            }

            FireEvent e = (FireEvent)EventInfos.Instance.Allocate(EEventType.Fire, false);

            e.owner          = attackProxy.Owner.Owner;
            e.fireEffectType = fireEffectType;
            e.pitch          = attackProxy.Orientation.Pitch;
            e.yaw            = attackProxy.Orientation.Yaw;
            e.weaponId       = attackProxy.WeaponConfigAssy.S_Id;
            attackProxy.Owner.RelatedLocalEvents.AddEvent(e);
        }
        private void AddPullBoltEvent(WeaponAttackProxy attackProxy)
        {
            var e = EventInfos.Instance.Allocate(EEventType.PullBolt, false);

            attackProxy.Owner.RelatedLocalEvents.AddEvent(e);
        }
Пример #11
0
 public static float GetSpreadScaleFactor(PistolSpreadLogicConfig pistolSpreadLogicConfig,
                                          WeaponAttackProxy attackProxy)
 {
     return(GetSpreadFactor(pistolSpreadLogicConfig, attackProxy));
 }
Пример #12
0
        private static float GetSpreadFactor(Spread spreadAimCfg, float fastMoveSpeed, WeaponAttackProxy attackProxy)
        {
            //fst layer
            var   posture      = attackProxy.CharacterState.GetCurrentPostureState();
            float spreadFactor = 1f;

            if (!attackProxy.PlayerMove.IsGround)
            {
                spreadFactor = spreadAimCfg.Air;
            }
            else if (attackProxy.PlayerMove.HorizontalVelocity > fastMoveSpeed)
            {
                spreadFactor = spreadAimCfg.FastMove;
            }
            else if (posture == PostureInConfig.Prone)
            {
                spreadFactor = spreadAimCfg.Prone;
            }
            else if (posture == PostureInConfig.Crouch)
            {
                spreadFactor = spreadAimCfg.Duck;
            }

            return(spreadFactor);
        }