Esempio n. 1
0
        public void Execute(float deltaTime)
        {
            if (_upTimer.MAXValue < _upTimer.CurrentValue)
            {
                AddBulletToList(_bulletPull.Get());

                _upTimer.ResetTimer();
            }
            else
            {
                for (int i = 0; i < _bullets.Count; i++)
                {
                    var bullet = _bullets[i];

                    MoveBullet(bullet, deltaTime);

                    if (_returnChecker.ShouldReturn(bullet))
                    {
                        _bulletPull.Return(bullet);
                    }
                }

                _bullets.RemoveAll(b => !b.gameObject.activeSelf);
            }

            _upTimer.UpTimerTick(deltaTime);
        }
Esempio n. 2
0
 private void AddEnemies(int capacity)
 {
     for (int i = 0; i < capacity; i++)
     {
         var enemy = _enemyPool.Get();
         enemy.SceneEnemy.gameObject.SetActive(true);
         _positionSetter.SetPosition(enemy.SceneEnemy);
         _enemies.Add(enemy);
     }
 }
Esempio n. 3
0
        public void Apply(IAbilityActivator activator)
        {
            GunAbilityView projectile = null;

            if (_gunPull.TryGetValue())
            {
                projectile = _gunPull.Get(activator);
            }

            if (projectile != null)
            {
                projectile.Rigidbody2D
                .AddForce(activator.GetViewObject().transform.right *_abilityItemConfig.Value, ForceMode2D.Force);
            }
        }
Esempio n. 4
0
        public void Execute(float deltaTime)
        {
            if (!_weaponLocker.IsLocked)
            {
                if (_fire.IsKeyDown())
                {
                    AddBulletToList(_bulletPull.Get());
                }
            }

            for (int i = 0; i < _bullets.Count; i++)
            {
                var bullet = _bullets[i];

                MoveBullet(bullet, deltaTime);

                if (_returnChecker.ShouldReturn(bullet))
                {
                    _bulletPull.Return(bullet);
                }
            }

            _bullets.RemoveAll(b => !b.gameObject.activeSelf);
        }