Exemple #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);
        }
Exemple #2
0
        private void SpawnPlayer(IBulletFactory bulletFactory)
        {
            var spaceshipTexture = Content.Load <Texture2D>("playerShip1_blue");
            var spaceshipRegion  = new TextureRegion2D(spaceshipTexture);

            _player = _entityManager.AddEntity(new Spaceship(spaceshipRegion, bulletFactory));
        }
Exemple #3
0
    private void OnShot(IBulletFactory bulletFactory, Vector3 direction)
    {
        Bullet bullet = PoolBullets.Instance.GetBullet;

        bullet.SetParametrs(bulletFactory);
        bullet.FireBullet(startShotPoint.position, direction);
    }
Exemple #4
0
        public Turrent()
        {
            this.Radius                   = 0.2f;
            this.BulletSpawnOffset        = 0.3f;
            this.IsRotationLockedToParent = true;

            this.BulletFactory = new BulletFactory();
        }
 public Spaceship(TextureRegion2D textureRegion, IBulletFactory bulletFactory)
 {
     _bulletFactory = bulletFactory;
     _sprite        = new Sprite(textureRegion)
     {
         Scale    = Vector2.One * 0.5f,
         Position = new Vector2(400, 240)
     };
 }
Exemple #6
0
 public SprayWeapon(IBulletFactory ammo) :
     base(ammo)
 {
     AppendOnShot(bullet =>
     {
         ReloadTime   = VALUES.BASIC_WEAPON_RELOAD_TIME / 2;
         bullet.Speed = new Vector(VALUES.random.Next(-15, 15), bullet.Speed.Y);
     });
 }
 public PlayerCreator(IPlayerFactory playerFactory, IEngineFactory engineFactory, IArmourFactory armourFactory, IWeaponFactory weaponFactory, ISpaceshipFactory spaceshipFactory, IBulletFactory bulletFactory)
 {
     this.playerFactory    = playerFactory;
     this.engineFactory    = engineFactory;
     this.armourFactory    = armourFactory;
     this.weaponFactory    = weaponFactory;
     this.spaceshipFactory = spaceshipFactory;
     this.bulletFactory    = bulletFactory;
 }
Exemple #8
0
    private void MoveBullet(IBulletFactory bulletFactory)
    {
        Vector3 mousePos = Input.mousePosition;

        mousePos.z = 10f;
        mousePos   = camera.ScreenToWorldPoint(mousePos);
        Vector3 direction = mousePos - camera.transform.position;

        StaticActions.OnShotEvent?.Invoke(bulletFactory, direction);
    }
 public Spaceship(TextureRegion2D textureRegion, IBulletFactory bulletFactory)
 {
     _bulletFactory = bulletFactory;
     _sprite = new Sprite(textureRegion)
     {
         Scale = Vector2.One * 0.5f,
         Position = new Vector2(400, 240)
     };
     _boundingCircle = new CircleF(_sprite.Position, 20);
 }
Exemple #10
0
 public BulletPool(int poolCapacity, BulletData bulletData, IBulletFactory factory)
 {
     _factory      = factory;
     _bulletPool   = new Dictionary <BulletTypes, HashSet <BaseBulletController> >();
     _poolCapacity = poolCapacity;
     _bulletData   = bulletData;
     if (!_poolRoot)
     {
         _poolRoot = new GameObject(ObjectNames.POOL_BULLETS).transform;
     }
 }
Exemple #11
0
 public void SetParametrs(IBulletFactory bulletFactory)
 {
     if (currentBulletFactory != bulletFactory)
     {
         currentBulletFactory = bulletFactory;
         rigidbody.useGravity = bulletFactory.GetGravity();
         speed                = bulletFactory.GetSpeed().Value();
         lifeTime             = bulletFactory.GetLifeTime().Value();
         scale                = bulletFactory.GetScale().Value();
         transform.localScale = Vector3.one * scale;
     }
 }
Exemple #12
0
 private void PlaySoundShot(IBulletFactory bulletFactory)
 {
     for (int i = 0; i < itemsSounds.Count; i++)
     {
         if (itemsSounds[i].TypeBullet == bulletFactory.GetType())
         {
             int       rndSound = UnityEngine.Random.Range(0, itemsSounds[i].Clips.Count);
             AudioClip clipShot = itemsSounds[i].Clips[rndSound];
             SoundController.Instance.Play(clipShot);
             break;
         }
     }
 }
 public FireController(IDirected player, IUserFireInputProxy fireInput, BulletData data, IBulletFactory bulletFactory)
 {
     CanExecute               = true;
     _player                  = player;
     _fireInput               = fireInput;
     _playerTransform         = player.GetPosition();
     _data                    = data;
     _fireInput.FireOnEnable += FireInput;
     _currentCooldown         = 0;
     _bulletFactory           = bulletFactory;
     _playerBullets           = new PlayerBullets();
     _fire                    = false;
 }
Exemple #14
0
        public ShootController(IUserInputProxy <bool> fireInputProxy, IBulletFactory bulletFactory,
                               BulletsSettings bulletsSettings, Transform bulletsPlaceHolder)
        {
            _fireInputProxy       = fireInputProxy;
            _bulletFactory        = bulletFactory;
            _bulletsSettings      = bulletsSettings;
            _generatedBulletsType = BulletsType.Single;
            _bulletsPlaceHolder   = bulletsPlaceHolder;

            _bulletsPool = new BulletProvider[_bulletsSettings.MaxBulletsInPool];

            _fireInputProxy.AxisOnChange += FireOnAxisOnChange;
        }
        void SwitchAmmo(int ammoType)
        {
            switch (ammoType)
            {
            case 1:
                _factory       = FindObjectOfType <KnifeFactory>();
                _ammoText.text = "Knife";
                break;

            case 2:
                _factory       = FindObjectOfType <MissileFactory>();
                _ammoText.text = "Missile";
                break;

            case 3:
                _factory       = FindObjectOfType <SeedFactory>();
                _ammoText.text = "Seed";
                break;
            }
        }
Exemple #16
0
 public SingleWeapon(IBulletFactory ammo) :
     base(ammo)
 {
 }
Exemple #17
0
 public BulletInitialization(IBulletFactory bulletFactory)
 {
     _bulletFactory = bulletFactory;
 }
Exemple #18
0
 /// <summary>
 ///  Constructor for the ShipManager.
 /// /// <param name="gridMap"> The GridMap for the PathFinder</param>
 /// </summary>
 public ShipManager(IGridMap gridMap, ContentManager content, IBulletFactory bulletFactory)
 {
     mPathFinder     = new PathFinder(gridMap);
     mContentManager = content;
     mBulletFactory  = bulletFactory;
 }
Exemple #19
0
        public void ApplyAttachment(IBulletFactory logic)
        {
            var factory = logic as WeaponLogicComponentsFactory.BulletFactory;

            factory.ApplyModifier(_attachAttributeDic[WeaponAttributeType.Speed]);
        }
Exemple #20
0
 public DoubleWeapon(IBulletFactory ammo) :
     base(ammo)
 {
     ReloadTime *= 3;
     ReloadTime /= 2;
 }
Exemple #21
0
 public TripleWeapon(IBulletFactory ammo) :
     base(ammo)
 {
     ReloadTime *= 2;
 }
Exemple #22
0
 private void OnShot(IBulletFactory bulletFactory, Vector3 empty)
 {
     PlaySoundShot(bulletFactory);
 }
 public BulletManager()
 {
     bulletFactory = new BulletFactory();
     bullets       = new List <IBullet>();
 }
 void OnDestroy()
 {
     angles = null;
     bulletFactory = null;
 }
Exemple #25
0
 public JuggerLaserWeapon(IBulletFactory ammo) :
     base(ammo)
 {
 }
Exemple #26
0
 public Cannon(Vector3 muzzlePosition, WeaponData weaponData, IBulletFactory bulletFactory)
 {
     _bulletFactory = bulletFactory;
     MuzzlePosition = muzzlePosition;
     WeaponData     = weaponData;
 }
 void Destroy()
 {
     bulletFactory = null;
     target = null;
 }
Exemple #28
0
 public Weapon(IBulletFactory ammo)
 {
     this.Ammo       = ammo;
     this.isLoaded   = true;
     this.ReloadTime = VALUES.BASIC_WEAPON_RELOAD_TIME;
 }