public bool AssignChainToNewTarget(BulletLightningBallChain chain) { ActionController ac = null; for (int i = _savedTarget.Count - 1; i >= 0; --i) { // clear dead enemys met in the target array. if (!_savedTarget[i].IsAlived) { _savedTarget.RemoveAt(i); continue; } // successed to assign new target. ac = _savedTarget[i]; _savedTarget.RemoveAt(i); chain.Active(ac, this); return(true); } return(false); }
protected override void Awake() { base.Awake(); _isRangerBullet = true; // make me be enable to override function 'FireRange()' _savedTarget = new System.Collections.Generic.List <ActionController>(); _freeChains = new System.Collections.Generic.List <BulletLightningBallChain>(); // add pool for thunder chain. _lightningChains = new BulletLightningBallChain[_maxTargetCount]; for (int i = 0; i < _maxTargetCount; ++i) { GameObject go = GameObject.Instantiate(_chain) as GameObject; go.transform.parent = LevelManager.Singleton.BulletRoot; go.SetActive(false); BulletLightningBallChain blbc = go.GetComponent <BulletLightningBallChain>(); blbc._pool = this; blbc._targetPart = _targetSolt; _lightningChains[i] = blbc; } Reset(); }
public void AddFreeChain(BulletLightningBallChain chain) { _freeChains.Add(chain); }