private void ExtendPelletsPool()
    {
        int i = 0;

        TracerParticleController[] pellets = null;
        if (_tracerParticleInstances != null)
        {
            pellets = new TracerParticleController[_tracerParticleInstances.Length + _pelletExtendAmount];
            Array.Copy(_tracerParticleInstances, pellets, _tracerParticleInstances.Length);
            i = _tracerParticleInstances.Length;
        }
        else
        {
            pellets = new TracerParticleController[_pelletExtendAmount];
        }

        GameObject tracerInstance = null;

        for (; i < pellets.Length; i++)
        {
            tracerInstance = (GameObject.Instantiate(_tracerParticlePrefab) as GameObject);
            tracerInstance.transform.SetParent(_tracersRoot);
            tracerInstance.transform.localPosition = Vector3.zero;
            tracerInstance.transform.localRotation = Quaternion.identity;

            pellets[i] = tracerInstance.AddComponent <TracerParticleController>();
            pellets[i].Stop();
        }

        _tracerParticleInstances = pellets;
    }
    private IEnumerator PlayInternal(float distanceToTarget, Vector3 pelletStartPosition)
    {
        TracerParticleController currentPellet = null;

        if (_wfsFirstPellek != null)
        {
            yield return(_wfsFirstPellek);
        }

        for (int i = 0; i < _pelletsPerAttack; i++)
        {
            currentPellet = GetFreePellet();
            if (currentPellet == null)
            {
                ExtendPelletsPool();
                currentPellet = GetFreePellet();
            }
            currentPellet.Play(distanceToTarget, pelletStartPosition, PlayExplosion);
            _gunfireParticleInstance.SetActive(true);
            yield return(_wfsGunfireDuration);

            _gunfireParticleInstance.SetActive(false);
            if (_wfsNextPellek != null)
            {
                yield return(_wfsNextPellek);
            }
        }
    }
	private void ExtendPelletsPool() {
		int i = 0;

		TracerParticleController[] pellets = null;
		if(_tracerParticleInstances != null) {
			pellets = new TracerParticleController[_tracerParticleInstances.Length + _pelletExtendAmount];
			Array.Copy(_tracerParticleInstances, pellets, _tracerParticleInstances.Length);
			i = _tracerParticleInstances.Length;
		} else {
			pellets = new TracerParticleController[_pelletExtendAmount];
		}

		GameObject tracerInstance = null;
		for (; i < pellets.Length; i++) {
			tracerInstance = (GameObject.Instantiate(_tracerParticlePrefab) as GameObject);
			tracerInstance.transform.SetParent(_tracersRoot);
			tracerInstance.transform.localPosition = Vector3.zero;
			tracerInstance.transform.localRotation = Quaternion.identity;

			pellets[i] = tracerInstance.AddComponent<TracerParticleController>();
			pellets[i].Stop();
		}

		_tracerParticleInstances = pellets;
	}