| | |
| | | using ActionGameFramework.Health; |
| | | using Core.Utilities; |
| | | using DG.Tweening; |
| | | using System; |
| | | using System.Net.Http.Headers; |
| | | using TowerDefense.Agents; |
| | | using TowerDefense.UI.HUD; |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | namespace TowerDefense.Towers.Projectiles |
| | | { |
| | |
| | | switch (id) |
| | | { |
| | | case 2: // 减速. |
| | | enemy.addSpeedSlowRate(0.15f); |
| | | enemy.SetTargetableMatColor(Color.blue); |
| | | (enemy as Agent).addSpeedSlowRate(0.15f); |
| | | break; |
| | | case 3: // 中毒 |
| | | enemy.poisonAgent(damage, attid); |
| | | enemy.SetTargetableMatColor(Color.green); |
| | | break; |
| | | case 5: // 破甲 |
| | | enemy.bShieldBreak = true; |
| | | (enemy as Agent).poisonAgent(damage, attid); |
| | | break; |
| | | } |
| | | return; |
| | |
| | | // 攻击目标已经经历过了Pool了,不能再攻击了。 |
| | | if (mLiveID != m_Enemy.liveID) return; |
| | | |
| | | // effects |
| | | // ParticleSystem pfxPrefab = m_Damager.collisionParticles; |
| | | // var attackEffect = Poolable.TryGetPoolable<ParticleSystem>(pfxPrefab.gameObject); |
| | | // attackEffect.transform.position = m_Enemy.position; |
| | | // attackEffect.Play(); |
| | | |
| | | // GameObject hitObj = Poolable.TryGetPoolable(m_Damager.collisionObj); |
| | | // ParticleSystem ps = hitObj.GetComponent<ParticleSystem>(); |
| | | // if (ps == null) |
| | | // ps = hitObj.transform.GetChild(0).GetComponent<ParticleSystem>(); |
| | | // ps.Play(); |
| | | // // StartCoroutine(RecycleParticle(hitObj, ps.main.duration)); |
| | | |
| | | // var hitVFX = Instantiate(m_Damager.collisionObj, m_Enemy.position, Quaternion.identity); |
| | | // var ps = hitVFX.GetComponent<ParticleSystem>(); |
| | | // if (ps == null) |
| | | // { |
| | | // var psChild = hitVFX.transform.GetChild(0).GetComponent<ParticleSystem>(); |
| | | // psChild.Play(); |
| | | // Destroy(hitVFX, psChild.main.duration); |
| | | // } |
| | | // else |
| | | // { |
| | | // ps.Play(); |
| | | // Destroy(hitVFX, ps.main.duration); |
| | | // } |
| | | |
| | | float finalDamage = m_Damager.finalDamage; |
| | | bool crit = m_Damager.isCrit; |
| | | if (crit) |
| | | { |
| | | finalDamage += finalDamage; |
| | | |
| | | // 暂时去掉这个ShakePosition的功能: |
| | | //m_Enemy.transform.DOShakePosition(0.5f); |
| | | } |
| | | // 精英怪和Boss双倍攻击. |
| | | bool doubleHit = m_Damager.doubleHit && m_Enemy.bElit; |
| | | if (doubleHit) |
| | | { |
| | | finalDamage *= 2; |
| | | } |
| | | |
| | | // |
| | | // 处理光塔对应的攻击增加: |
| | | if (attackRise > 0) |
| | | finalDamage += (finalDamage * attackRise); |
| | | // 破甲状态 |
| | | if (m_Enemy.bShieldBreak) |
| | | finalDamage += (finalDamage * 0.1f); |
| | | |
| | | // |
| | | // 提前处理非当前Enemy的爆炸攻击: |
| | | if (chainAttackRate > 0) |
| | | AgentInsManager.instance.StartExplodeAttack(m_Enemy as Agent, finalDamage); |
| | |
| | | ProcessTowerAttributeAttack(m_Enemy, finalDamage, attributeId); |
| | | |
| | | if (!m_Enemy.opponentAgent) |
| | | GameUI.instance.generateBloodText(backPos, finalDamage, crit, doubleHit); |
| | | GameUI.instance.generateBloodText(backPos, finalDamage, crit); |
| | | |
| | | // 播放受击动画: |
| | | if ((!m_Enemy.isDead) && (m_Enemy.liveID == tid)) |
| | | (m_Enemy as Agent).PlayOnHit(); |
| | | |
| | | // 重设到开始位置的处理. liveID必须要等于tid. |
| | | /*if( (resetStartPosRate > 0)&&(!m_Enemy.isDead)&& (m_Enemy.liveID == tid)) |
| | | { |
| | | if (mRand.NextDouble() < resetStartPosRate) |
| | | { |
| | | Agent ag = m_Enemy as Agent; |
| | | if( ag.bBoss) |
| | | { |
| | | // 如果是Boss,更低的概率重设位置. |
| | | if (mRand.NextDouble() < resetStartPosRate / 20.0f) |
| | | ag.execAgentPosResetAction(); |
| | | } |
| | | else |
| | | ag.execAgentPosResetAction(); |
| | | } |
| | | |
| | | }*/ |
| | | |
| | | /*// 链式攻击的测试处理: 需要确保是同一个敌人,ID相同. |
| | | if( (chainAttackRate > 0)&& (!m_Enemy.isDead) && (m_Enemy.liveID == tid) ) |
| | | { |
| | | if (mRand.NextDouble() < chainAttackRate) |
| | | AgentInsManager.instance.StartChainAttack(m_Enemy as Agent,m_Damager.alignmentProvider,(float)Math.Floor(finalDamage/2.0f )); |
| | | |
| | | }*/ |
| | | |
| | | m_PauseTimer = true; |
| | | } |