예제 #1
0
        public DefaultFireLogic(
            NewWeaponConfigItem newWeaponConfig,
            DefaultFireLogicConfig config,
            IWeaponLogicComponentsFactory componentsFactory,
            IAttachmentManager attachmentManager,
            IWeaponSoundLogic soundLogic,
            IWeaponEffectLogic effectLogic,
            IBulletFireInfoProviderDispatcher bulletFireInfoProviderDispatcher) : base(config)
        {
            _attachmentManager      = attachmentManager;
            _accuracyLogic          = componentsFactory.CreateAccuracyLogic(config.AccuracyLogic, config.Basic);
            _spreadLogic            = componentsFactory.CreateSpreadLogic(config.SpreadLogic, config.Basic);
            _autoFireLogic          = componentsFactory.CreateAutoFireLogic(config.FireModeLogic, config.Basic);
            _bulletLogic            = componentsFactory.CreateBulletLogic(config.Basic);
            _soundLogic             = soundLogic;
            _weaponEffectLogic      = effectLogic;
            _bulletFireInfoProvider = bulletFireInfoProviderDispatcher;

            _bulletFactory       = componentsFactory.CreateBulletFactory(config.Bullet, config.Basic);
            _kickbackLogic       = componentsFactory.CreateKickbackLogic(config.KickbackLogic, config.Basic);
            _fireBulletModeLogic = componentsFactory.CreateFireReadyLogic(config.FireModeLogic, config.Basic);
            _fireBulletCounter   = componentsFactory.CreateContinuesShootLogic(config.FireCounter, config.Basic);
            _fireActionLogic     = componentsFactory.CreateFireActionLogic(newWeaponConfig, config.Basic, _soundLogic);

            AddLogic(_accuracyLogic);
            AddLogic(_spreadLogic);
            AddLogic(_kickbackLogic);
            AddLogic(_autoFireLogic);
            AddLogic(_fireBulletModeLogic);
            AddLogic(_fireActionLogic);
            AddLogic(_fireBulletCounter);
        }
예제 #2
0
        private IFireLogic CreateDefaultFireLogic(NewWeaponConfigItem newWeaponConfig,
                                                  DefaultFireLogicConfig config)
        {
            var fireLogic = new DefaultFireLogic();

            fireLogic.RegisterLogic(_componentsFactory.CreateAccuracyLogic(config.AccuracyLogic));
            fireLogic.RegisterLogic(_componentsFactory.CreateSpreadLogic(config.SpreadLogic));
            fireLogic.RegisterLogic(_componentsFactory.CreateKickbackLogic(config.KickbackLogic));

            fireLogic.RegisterLogic(_componentsFactory.CreateFireCheckLogic(config.FireModeLogic));
            fireLogic.RegisterLogic(_componentsFactory.CreateFireActionLogic(newWeaponConfig));
            fireLogic.RegisterLogic(_componentsFactory.CreateFireBulletCounterLogic(config.FireCounter));
            fireLogic.RegisterLogic(_componentsFactory.CreateAutoFireLogic(config.FireModeLogic));
            fireLogic.RegisterLogic(_componentsFactory.CreateBulletFireLogic(config.Bullet));
            fireLogic.RegisterLogic(_componentsFactory.CreateSpecialReloadCheckLogic(config.Basic));
            fireLogic.RegisterLogic(_componentsFactory.CreateFireCommandLogic(config));
            fireLogic.RegisterLogic(_componentsFactory.CreateShowFireInMap(config));
            return(fireLogic);
        }