コード例 #1
0
        public void OnAfterFire(WeaponBaseAgent heldBaseAgent, WeaponSideCmd cmd)
        {
            if (heldBaseAgent.BaseComponent.RealFireModel != (int)EFireMode.Burst)
            {
                return;
            }

            var runTimeComponent = heldBaseAgent.RunTimeComponent;

            runTimeComponent.NeedAutoBurstShoot = false;
            var config = heldBaseAgent.DefaultFireModeLogicCfg;

            runTimeComponent.BurstShootCount += 1;
            float intervalFactor = 1 - heldBaseAgent.GetAttachedAttributeByType(WeaponAttributeType.AttackInterval) / 100;

            if (runTimeComponent.BurstShootCount < config.BurstCount)
            {
                runTimeComponent.NextAttackTimestamp = cmd.UserCmd.RenderTime + Mathf.CeilToInt(config.BurstAttackInnerInterval * intervalFactor);
                runTimeComponent.NeedAutoBurstShoot  = true;
                runTimeComponent.IsPrevCmdFire       = true;
            }
            else
            {
                runTimeComponent.NextAttackTimestamp = cmd.UserCmd.RenderTime + Mathf.CeilToInt(config.BurstAttackInterval * intervalFactor);
                runTimeComponent.BurstShootCount     = 0;
            }
            if (heldBaseAgent.BaseComponent.Bullet == 0)
            {
                runTimeComponent.BurstShootCount = 0;
            }
        }
コード例 #2
0
        public static ShakeInfoStruct GetFireUpDirShakeArgs(WeaponBaseAgent heldAgent, ShakeInfo shakeInfo)
        {
            var newInfo = (ShakeInfoStruct)shakeInfo;

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

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

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

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

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

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

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

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

            return(newInfo);
        }
コード例 #3
0
        public void OnAfterFire(WeaponBaseAgent weaponBaseAgent, WeaponSideCmd cmd)
        {
            if ((EFireMode)weaponBaseAgent.BaseComponent.RealFireModel == EFireMode.Burst)
            {
                return;
            }
            var runtimeDataComponent = weaponBaseAgent.RunTimeComponent;

            runtimeDataComponent.IsPrevCmdFire = true;
            float intervalFactor = 1 - weaponBaseAgent.GetAttachedAttributeByType(WeaponAttributeType.AttackInterval) / 100;

            runtimeDataComponent.NextAttackTimestamp = cmd.UserCmd.RenderTime + Mathf.CeilToInt(weaponBaseAgent.CommonFireCfg.AttackInterval * intervalFactor);
            runtimeDataComponent.NeedAutoBurstShoot  = false;
            runtimeDataComponent.ContinuesShootCount = 0;
            runtimeDataComponent.LastAttackTimestamp = cmd.UserCmd.RenderTime;
        }