| | |
| | | /// 木塔最后一击是特殊攻击,需要替换projectile |
| | | /// </summary> |
| | | public GameObject woodProjectile_SP; |
| | | // |
| | | protected GameObject projectile1; |
| | | protected GameObject projectile2; |
| | | |
| | | /// <summary> |
| | | /// The list of points to launch the projectiles from |
| | |
| | | public Transform epicenter; |
| | | |
| | | /// <summary> |
| | | /// Configuration for when the tower does splash damage |
| | | /// </summary> |
| | | public bool isMultiAttack; |
| | | |
| | | /// <summary> |
| | | /// 如果是多目标攻击,最多攻击目标 |
| | | /// </summary> |
| | | public int maxAttackNum = 1; |
| | | |
| | | /// <summary> |
| | | /// The fire rate in fires-per-second |
| | | /// </summary> |
| | | [SerializeField] |
| | | private float projectileFireRate = 1; |
| | | |
| | | public float FireRate |
| | | { |
| | | get { return 1 / GetFireDuration(); } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 是否木属性数据 |
| | |
| | | float rateAdd = 0; |
| | | |
| | | if (fireRateAdd != null) |
| | | rateAdd = fireRateAdd.GetFireSpeedAdd(towerPtr.attributeId); |
| | | rateAdd = fireRateAdd.GetFireSpeedAdd(towerPtr.ElfId); |
| | | return rateAdd > 1 ? rateAdd : fireSpeed; |
| | | } |
| | | } |
| | |
| | | public Damager damagerProjectile2 |
| | | { |
| | | get { return projectile == null ? null : projectile.GetComponent<Damager>(); } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// Returns the total projectile damage |
| | | /// </summary> |
| | | public float GetProjectileDamage() |
| | | { |
| | | var splash = projectile.GetComponent<SplashDamager>(); |
| | | float splashDamage = splash != null ? splash.damage : 0; |
| | | return damagerProjectile.finalDamage + splashDamage; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | Damager damager = projectile.gameObject.GetComponent<Damager>(); |
| | | float finalDamage = damager.damage; |
| | | |
| | | List<EndlessBuffConfig> list = EndlessBuffManager.instance.GetBuffListByEffectType(EndlessBuffEffectType.AttackAdd, towerPtr.attributeId); |
| | | List<EndlessBuffConfig> list = EndlessBuffManager.instance.GetBuffListByEffectType(EndlessBuffEffectType.AttackAdd, towerPtr.ElfId); |
| | | float ratio = 0; |
| | | float add = 0; |
| | | |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取子弹发射时间间隔 |
| | | /// </summary> |
| | | public float GetFireDuration() |
| | | { |
| | | DecreaseTowerAttackCD endlessBuff = (DecreaseTowerAttackCD)EndlessBuffManager.instance.GetBuffInstanceByType(EndlessBuffEffectType.DecreaseTowerAttackCD); |
| | | |
| | | return endlessBuff != null ? endlessBuff.GetDecreaseCD(towerPtr.attributeId, 1 / projectileFireRate) : 1 / projectileFireRate; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Update the timers |
| | | /// </summary> |
| | | protected virtual void Update() |
| | |
| | | |
| | | if (m_TrackingEnemy != null && m_FireTimer < 0) |
| | | { |
| | | m_FireTimer = GetFireDuration(); |
| | | m_FireTimer = towerLevel.GetFireRate(); |
| | | |
| | | if (fInEnergy > 0) |
| | | m_FireTimer /= finalFireSpeed; |
| | |
| | | /// </summary> |
| | | public virtual void FireProjectile() |
| | | { |
| | | // 不再处理多子弹攻击,确保只有一个弹道 |
| | | isMultiAttack = false; |
| | | m_TrackingEnemy = targetter.GetTarget(waveLineID, bWoodAffector); |
| | | |
| | | GameObject go = damagerProjectile.gameObject; |
| | | |
| | | if (m_TrackingEnemy == null || fillBulletTime > 0) return; |
| | | |
| | | go.GetComponent<Damager>().IsEnhancedBullet = false; |
| | | Damager goDamager = go.GetComponent<Damager>(); |
| | | goDamager.IsEnhancedBullet = false; |
| | | goDamager.TowerPtr = towerPtr; |
| | | |
| | | // 处理子弹充能相关的内容 |
| | | if (towerPtr && towerPtr.bulletCtl != null) |
| | |
| | | tmpDamager.damageMulti = 10.0f; |
| | | tmpDamager.damage = damagerProjectile.damage; |
| | | tmpDamager.IsEnhancedBullet = true; |
| | | tmpDamager.TowerPtr = towerPtr; |
| | | } |
| | | |
| | | // 下一颗子弹是强化子弹,然后直接蓄力 |
| | |
| | | } |
| | | } |
| | | |
| | | if (isMultiAttack) |
| | | if (Targetter.bSearchTarget) |
| | | { |
| | | List<Targetable> enemies = towerTargetter.GetAllTargets(); |
| | | if ((enemies != null) && (Targetter.bSearchTarget)) |
| | | m_Launcher.Launch(enemies, projectile, projectilePoints, maxAttackNum); |
| | | m_Launcher.Launch(m_TrackingEnemy, go, projectilePoints); |
| | | if (AudioSourceManager.Ins) |
| | | AudioSourceManager.Ins.Play(audioEnum); |
| | | } |
| | | else |
| | | { |
| | | if (Targetter.bSearchTarget) |
| | | { |
| | | m_Launcher.Launch(m_TrackingEnemy, go, projectilePoints); |
| | | if (AudioSourceManager.Ins) |
| | | AudioSourceManager.Ins.Play(audioEnum); |
| | | } |
| | | } |
| | | // if (randomAudioSource != null) |
| | | // { |
| | | // if (Targetter.bSearchTarget) |
| | | // randomAudioSource.PlayRandomClip(); |
| | | // } |
| | | } |
| | | |
| | | /// <summary> |