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); }
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); }
public void ApplyAttachment(IWeaponEffectLogic logic) { var defaultLogic = logic as DefaultWeaponEffectLogic; if (null != defaultLogic) { ApplyAttachment(defaultLogic); } }
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; }
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); }
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 MeleeFireLogic(MeleeFireLogicConfig config, IWeaponSoundLogic sound, IWeaponEffectLogic effect) : base(config) { _config = config; _soundLogic = sound; _effectLogic = effect; }