| | |
| | | /// </summary> |
| | | protected Targetable m_TrackingEnemy; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 处理装弹时间. |
| | | /// </summary> |
| | | protected float fillBulletTime = 0.0f; |
| | | |
| | | /// <summary> |
| | | /// Gets the search rate from the targetter |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | protected virtual void Update() |
| | | { |
| | | // |
| | | // 预留出来装填子弹的时间. |
| | | if( fillBulletTime > 0 ) |
| | | { |
| | | fillBulletTime -= Time.deltaTime; |
| | | if (fillBulletTime <= 0.3f) |
| | | { |
| | | if (towerPtr && towerPtr.bulletCtl) |
| | | towerPtr.bulletCtl.resetToMaxBullet(); |
| | | } |
| | | |
| | | if (fillBulletTime <= 0) |
| | | { |
| | | fillBulletTime = 0; |
| | | } |
| | | } |
| | | |
| | | m_FireTimer -= Time.deltaTime; |
| | | if( trackingEnemy == null ) |
| | | m_TrackingEnemy = targetter.GetTarget(waveLineID, bWoodAffector); |
| | |
| | | // 不再处理多子弹攻击,确保只有一个弹道 |
| | | isMultiAttack = false; |
| | | m_TrackingEnemy = targetter.GetTarget( waveLineID, bWoodAffector ); |
| | | if (m_TrackingEnemy == null) |
| | | if ( (m_TrackingEnemy == null) || (fillBulletTime>0) ) |
| | | { |
| | | if (this.towerPtr) |
| | | towerPtr.setTowerState(false); |
| | | return; |
| | | } |
| | | }else |
| | | { |
| | | if (this.towerPtr) |
| | | towerPtr.setTowerState(true); |
| | | } |
| | | |
| | | // |
| | | // 处理子弹充能相关的内容 |
| | | if( towerPtr && (towerPtr.bulletCtl != null)) |
| | | { |
| | | int bnum = towerPtr.bulletCtl.decBullet(); |
| | | // |
| | | if (bnum == 0) |
| | | { |
| | | damagerProjectile.damageMulti = 2.0f; |
| | | fillBulletTime = 2.0f; |
| | | } |
| | | } |
| | | |
| | | if (isMultiAttack) |
| | | { |