Assets/Prefabs/Towers/Fire/GrowUpTower.prefab | ●●●●● patch | view | raw | blame | history | |
Assets/Scripts/TowerDefense/Affectors/AttackAffector.cs | ●●●●● patch | view | raw | blame | history | |
Assets/Scripts/TowerDefense/Towers/Tower.cs | ●●●●● patch | view | raw | blame | history | |
Assets/Scripts/TowerDefense/UI/EnergyUICtl.cs | ●●●●● patch | view | raw | blame | history |
Assets/Prefabs/Towers/Fire/GrowUpTower.prefab
@@ -123,7 +123,7 @@ materialTowerWaitSelf: {fileID: 0} materialTowerAttackOppo: {fileID: 0} materialTowerWaitOppo: {fileID: 0} eTowerFuntion: 0 eTowerFuntion: 2 bulletCtl: {fileID: 0} levels: - {fileID: 114779466188146336, guid: 0ead2ba21a4e3e84e9bca834100c4456, type: 3} Assets/Scripts/TowerDefense/Affectors/AttackAffector.cs
@@ -101,11 +101,17 @@ /// </summary> protected Targetable m_TrackingEnemy; /// <summary> /// 处理装弹时间. /// </summary> protected float fillBulletTime = 0.0f; /// <summary> /// 充能时间 /// </summary> protected float energyCalTime = 0; protected float fInEnergy = 0; protected float fBackupTimer = 0.0f; /// <summary> /// Gets the search rate from the targetter @@ -224,10 +230,8 @@ m_Launcher = GetComponent<ILauncher>(); } /// <summary> /// Update the timers /// </summary> protected virtual void Update() protected void updateTowerSkillData() { // // 预留出来装填子弹的时间. @@ -246,6 +250,50 @@ } } // // 充能时间的处理 if( towerPtr && towerPtr.energyCtl) { if( this.fInEnergy <= 0) { this.energyCalTime += Time.deltaTime; float process = energyCalTime % 11.0f; int proint = (int)Math.Floor(process); towerPtr.energyCtl.SetEnergyProgress(proint); if (proint == 10) { fInEnergy = 5.0f; // 设置多倍攻击速度 fBackupTimer = m_FireTimer; m_FireTimer = m_FireTimer / 3.0f; } } else { fInEnergy -= Time.deltaTime; if( fInEnergy <= 0) { fInEnergy = 0.0f; this.energyCalTime = 0.0f; towerPtr.energyCtl.SetEnergyProgress(0); // 恢复正常攻击速度 m_FireTimer = fBackupTimer; } } } } /// <summary> /// Update the timers /// </summary> protected virtual void Update() { // 处理当前Affector所在Tower对应的技能 updateTowerSkillData(); m_FireTimer -= Time.deltaTime; if( trackingEnemy == null ) m_TrackingEnemy = targetter.GetTarget(waveLineID, bWoodAffector); @@ -253,6 +301,10 @@ { OnFireTimer(); m_FireTimer = 1 / fireRate; // 多倍攻速: if (fInEnergy > 0.0f) m_FireTimer = m_FireTimer / 3.0f; } } @@ -277,7 +329,6 @@ /// </summary> protected virtual void FireProjectile() { // WORK START: 确保获取 // 不再处理多子弹攻击,确保只有一个弹道 isMultiAttack = false; m_TrackingEnemy = targetter.GetTarget( waveLineID, bWoodAffector ); Assets/Scripts/TowerDefense/Towers/Tower.cs
@@ -75,6 +75,7 @@ /// </summary> public ETowerFuntion eTowerFuntion = ETowerFuntion.NULL; public BulletUICtl bulletCtl = null; public EnergyUICtl energyCtl = null; /// <summary> /// The tower levels associated with this tower @@ -196,7 +197,6 @@ // 处理Tower this.setTowerState(false); if (opponentSide) { OpponentMgr.instance.SetTowerAttID(gridPosition.x, attributeId, this.currentLevel); @@ -215,6 +215,15 @@ } } // 处理塔位边上的界面. OnTowerUICtrl(); } } } protected void OnTowerUICtrl() { // // 根据是否是子弹塔防来决定是否显示相应的界面 BulletUICtl buc = this.placementArea.GetBulletUICtl(gridPosition.x); @@ -231,8 +240,21 @@ buc.gameObject.SetActive(false); this.bulletCtl = null; } } // 根据是否是能量充能来决定是否显示相应的界面. EnergyUICtl euc = placementArea.GetEnergyUICtl(gridPosition.x); if( (eTowerFuntion == ETowerFuntion.ENERGY) &&(euc != null )) { // 设置数据 euc.gameObject.SetActive(true); this.energyCtl = euc; euc.SetEnergyProgress(0); } else { // 清空数据 euc.gameObject.SetActive(false); this.energyCtl = null; } } Assets/Scripts/TowerDefense/UI/EnergyUICtl.cs
@@ -12,9 +12,9 @@ public Image energyScaleMask; /// <summary> /// 当前的能量条进度. /// 当前的能量条进度.10份进度. /// </summary> protected float currentProgress; protected int currentProgress; // Start is called before the first frame update void Start() @@ -27,9 +27,11 @@ /// 显示并更新能量条进度. /// </summary> /// <param name="pro"></param> public void SetEnergyProgress(float pro) public void SetEnergyProgress(int pro) { energyScaleMask.rectTransform.DOScaleY( pro, 0.3f ); if (pro == currentProgress) return; energyScaleMask.rectTransform.DOScaleY( pro / 10.0f, 0.3f ); currentProgress = pro; }