River Jiang
2020-10-21 40a2cbb83c4d0485ed52d4d87db78bb3c0e3fcbb
隐藏子弹条.
5 files modified
66 ■■■■■ changed files
Assets/Scripts/ActionGameFramework/Health/Damager.cs 16 ●●●●● patch | view | raw | blame | history
Assets/Scripts/TowerDefense/Affectors/AttackAffector.cs 39 ●●●●● patch | view | raw | blame | history
Assets/Scripts/TowerDefense/Towers/Tower.cs 6 ●●●●● patch | view | raw | blame | history
Assets/Scripts/TowerDefense/Towers/TowerLaunchers/BallisticLauncher.cs 1 ●●●● patch | view | raw | blame | history
Assets/Scripts/TowerDefense/UI/BulletUICtl.cs 4 ●●● patch | view | raw | blame | history
Assets/Scripts/ActionGameFramework/Health/Damager.cs
@@ -18,6 +18,11 @@
        public float damage;
        /// <summary>
        /// 用于最后一颗子弹的多倍攻击
        /// </summary>
        public float damageMulti = 1.0f;
        /// <summary>
        /// TEST CODE TO TOWER_NAME
        /// </summary>
        public string towerName = "";
@@ -105,7 +110,16 @@
        /// </summary>
        public float finalDamage
        {
            get { return damage + inSceneUpGradeDamage; }
            get {
                float fd = damage * damageMulti;
                if (damageMulti > 1.0f)
                    Debug.Log("hello,world:" + damageMulti.ToString() );
                damageMulti = 1.0f;
                return fd + inSceneUpGradeDamage;
            }
        }
        /// <summary>
Assets/Scripts/TowerDefense/Affectors/AttackAffector.cs
@@ -101,6 +101,12 @@
        /// </summary>
        protected Targetable m_TrackingEnemy;
        /// <summary>
        /// 处理装弹时间.
        /// </summary>
        protected float fillBulletTime = 0.0f;
        /// <summary>
        /// Gets the search rate from the targetter
        /// </summary>
@@ -223,6 +229,23 @@
        /// </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);
@@ -258,7 +281,7 @@
            // 不再处理多子弹攻击,确保只有一个弹道
            isMultiAttack = false; 
            m_TrackingEnemy = targetter.GetTarget( waveLineID, bWoodAffector );
            if (m_TrackingEnemy == null)
            if ( (m_TrackingEnemy == null) || (fillBulletTime>0) )
            {
                if (this.towerPtr) 
                    towerPtr.setTowerState(false);
@@ -269,6 +292,20 @@
                    towerPtr.setTowerState(true);
            }
            //
            // 处理子弹充能相关的内容
            if( towerPtr && (towerPtr.bulletCtl != null))
            {
                int bnum = towerPtr.bulletCtl.decBullet();
                //
                if (bnum == 0)
                {
                    damagerProjectile.damageMulti = 2.0f;
                    Debug.Log("设置DamgeMult 2.0");
                    fillBulletTime = 2.0f;
                }
            }
            if (isMultiAttack)
            {
                List<Targetable> enemies = towerTargetter.GetAllTargets();
Assets/Scripts/TowerDefense/Towers/Tower.cs
@@ -72,7 +72,7 @@
        /// 塔防对应的充能状态.
        /// </summary>
        public ETowerFuntion eTowerFuntion = ETowerFuntion.NULL;
        protected BulletUICtl bulletCtl = null;
        public BulletUICtl bulletCtl = null;
        /// <summary>
        /// The tower levels associated with this tower
@@ -115,6 +115,7 @@
        /// 攻击增加
        /// </summary>
        public float attackRise { get; set; }
        /// <summary>
        /// 塔防数据的局内升级
@@ -200,12 +201,13 @@
                    if (this.eTowerFuntion == ETowerFuntion.BULLET)
                    {
                        BulletUICtl buc = this.placementArea.GetBulletUICtl(gridPosition.x);
                        /*
                        if (buc)
                        {
                            buc.gameObject.SetActive(true);
                            this.bulletCtl = buc;
                            buc.resetToMaxBullet();
                        }
                        }*/
                    }
                }
Assets/Scripts/TowerDefense/Towers/TowerLaunchers/BallisticLauncher.cs
@@ -37,7 +37,6 @@
                DestroyImmediate(projectile);
                return;
            }
            ballisticProjectile.FireAtPoint(startPosition, enemy.position);
            if (fireParticleObj != null)
Assets/Scripts/TowerDefense/UI/BulletUICtl.cs
@@ -1,4 +1,5 @@
using DG.Tweening;
using Protobuf;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@@ -31,10 +32,11 @@
    /// </summary>
    public void resetToMaxBullet()
    {
        if (this.curBulletNum == maxBulletNum) return;
        this.curBulletNum = maxBulletNum;
        this.updateBulletUI(curBulletNum, maxBulletNum);
    }
    /// <summary>
    /// 减少子弹,返回减少后的子弹数目。