public IWeaponLogic CreateWeaponLogic(NewWeaponConfigItem newCfg,
                                              WeaponLogicConfig config,
                                              IWeaponSoundLogic soundLogic,
                                              IWeaponEffectLogic effectLogic,
                                              IBulletFireInfoProviderDispatcher bulletFireInfoProvider)
        {
            IWeaponLogic rc = null;

            if (config is DefaultWeaponLogicConfig)
            {
                rc = new DefaultWeaponLogic(newCfg,
                                            config as DefaultWeaponLogicConfig,
                                            this,
                                            soundLogic,
                                            effectLogic,
                                            _attachmentManager,
                                            bulletFireInfoProvider);
            }
            else if (config is DoubleWeaponLogicConfig)
            {
                rc = new DoubleWeaponLogic(newCfg,
                                           config as DoubleWeaponLogicConfig,
                                           this, soundLogic,
                                           effectLogic,
                                           _attachmentManager,
                                           bulletFireInfoProvider);
            }

            return(rc);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        public void ApplyAttachment(IWeaponSoundLogic logic)
        {
            var defaultLogic = logic as DefaultWeaponSoundLogic;

            if (null != defaultLogic)
            {
                ApplyAttachment(defaultLogic);
            }
        }
Exemplo n.º 4
0
 public DoubleWeaponLogic(NewWeaponConfigItem newCfg,
                          DoubleWeaponLogicConfig config,
                          IWeaponLogicComponentsFactory componentsFactory,
                          IWeaponSoundLogic soundLogic,
                          IWeaponEffectLogic effectLogic,
                          IAttachmentManager attachmentManager,
                          IBulletFireInfoProviderDispatcher bulletFireInfoProviderDispatcher) : base(config, componentsFactory)
 {
     _leftFireLogic     = componentsFactory.CreateFireLogic(newCfg, config.LeftFireLogic, soundLogic, effectLogic, bulletFireInfoProviderDispatcher);
     _rightFireLogic    = componentsFactory.CreateFireLogic(newCfg, config.RightFireLogic, soundLogic, effectLogic, bulletFireInfoProviderDispatcher);
     _attachmentManager = attachmentManager;
 }
Exemplo n.º 5
0
        public ThrowingFireAction(
            NewWeaponConfigItem newWeaponConfig,
            ThrowingFireLogicConfig config,
            IWeaponLogicComponentsFactory componentsFactory,
            IAttachmentManager attachmentManager,
            IWeaponSoundLogic soundLogic,
            IWeaponEffectLogic effectLogic) : base(config)
        {
            _attachmentManager = attachmentManager;
            _soundLogic        = soundLogic;
            _weaponEffectLogic = effectLogic;

            _throwingLogic   = componentsFactory.CreateThrowingLogic(config.Basic);
            _throwingFactory = componentsFactory.CreateThrowingFactory(newWeaponConfig, config.Throwing);
        }
Exemplo n.º 6
0
        public IWeaponLogic CreateWeaponLogic(NewWeaponConfigItem newCfg,
                                              WeaponConfig config,
                                              IWeaponSoundLogic soundLogic,
                                              IWeaponEffectLogic effectLogic)
        {
            IWeaponLogic rc = null;
            var          weaponLogicConfig = config.WeaponLogic;

            if (weaponLogicConfig is DefaultWeaponLogicConfig)
            {
                rc = new DefaultWeaponLogic();
            }
            else if (weaponLogicConfig is DoubleWeaponLogicConfig)
            {
                rc = new DoubleWeaponLogic(null, null);
            }
            return(rc);
        }
        public IFireLogic CreateFireLogic(NewWeaponConfigItem newWeaponConfig,
                                          FireLogicConfig config,
                                          IWeaponSoundLogic soundLogic,
                                          IWeaponEffectLogic effectLogic,
                                          IBulletFireInfoProviderDispatcher bulletFireInfoProviderDispatcher)
        {
            var defaultCfg = config as DefaultFireLogicConfig;

            if (null != defaultCfg)
            {
                return(new DefaultFireLogic(
                           newWeaponConfig,
                           defaultCfg,
                           this,
                           _attachmentManager,
                           soundLogic,
                           effectLogic,
                           bulletFireInfoProviderDispatcher));
            }
            var meleeCfg = config as MeleeFireLogicConfig;

            if (null != meleeCfg)
            {
                return(new MeleeFireLogic(meleeCfg, soundLogic, effectLogic));
            }
            var throwingCfg = config as ThrowingFireLogicConfig;

            if (null != throwingCfg)
            {
                return(new ThrowingFireAction(
                           newWeaponConfig,
                           throwingCfg,
                           this,
                           _attachmentManager,
                           soundLogic,
                           effectLogic));
            }
            return(null);
        }
        public IWeaponLogic CreateWeaponLogic(int weaponId, IWeaponSoundLogic soundLogic, IWeaponEffectLogic effectLogic, IBulletFireInfoProviderDispatcher bulletFireInfoProvider)
        {
            foreach (var row in Configs.Weapons)
            {
                if (row.Id == weaponId)
                {
                    var weaponCfg = SingletonManager.Get <WeaponConfigManager>().GetConfigById(weaponId);
                    var rc        = _componentsFactory.CreateWeaponLogic(
                        weaponCfg,
                        row.WeaponLogic,
                        soundLogic,
                        effectLogic,
                        bulletFireInfoProvider);
                    if (rc == null)
                    {
                        throw new Exception("unconfiged weapon " + weaponId);
                    }
                    rc.Reset();
                    return(rc);
                }
            }

            return(null);
        }
 public IFireActionLogic CreateFireActionLogic(NewWeaponConfigItem config, CommonFireConfig commonConfig, IWeaponSoundLogic weaponSoundLogic)
 {
     if (SingletonManager.Get <WeaponConfigManager>().IsSpecialType(config.Id, ESpecialWeaponType.SniperFrie))
     {
         return(new SpecialFireActionLogic(commonConfig, weaponSoundLogic));
     }
     else
     {
         return(new DefaultFireActionLogic(commonConfig, weaponSoundLogic));
     }
 }
Exemplo n.º 10
0
 public MeleeFireLogic(MeleeFireLogicConfig config, IWeaponSoundLogic sound, IWeaponEffectLogic effect) : base(config)
 {
     _config      = config;
     _soundLogic  = sound;
     _effectLogic = effect;
 }
Exemplo n.º 11
0
 public SpecialFireActionLogic(CommonFireConfig config, IWeaponSoundLogic weaponSoundLogic) : base(config)
 {
     _weaponSoundLogic = weaponSoundLogic;
 }
Exemplo n.º 12
0
 public DefaultFireActionLogic(CommonFireConfig config, IWeaponSoundLogic weaponSoundLogic) : base(config)
 {
 }