wangguan
2020-12-11 3bf196801c6b59ec05ab0a51f30e6193036ef925
Assets/Scripts/TowerDefense/UI/HUD/EndlessRandomTower.cs
@@ -245,45 +245,67 @@
        RandomPlaceTower(newTower, -1, -1, -1, -1, true);
        btnPS?.Play();
        //重置倒计时
        // if (newTower.towerFeature == EFeatureTower.NULL)
        // {
        //     string tmpTowerName = newTower.towerName;
        //     towerNameLis.Add(tmpTowerName);
        //     int count = 0;
        //     bool isFirstBuy = true;
        //     for (int i = 0; i < towerNameLis.Count; i++)
        //     {
        //         if (towerNameLis[i] == tmpTowerName)
        //         {
        //             count++;
        //             if (count == 2)
        //             {
        //                 isFirstBuy = false;
        //                 break;
        //             }
        //         }
        //     }
        //     if (isFirstBuy)
        //     {
        //         //Debug.Log("首次购买:" + tmpTowerName);
        //     }
        //     else
        //     {
        //         //Debug.Log("购买了多次了:" + tmpTowerName);
        //     }
        //     RandomPlaceTower(newTower, -1, -1, -1, -1, isFirstBuy);
        // }
        // else
        // {
        //     RandomPlaceTower(newTower, -1, -1, -1, -1, false);
        // }
        if (!isCountStartDown)
        {
            needClickPS.Stop();
            isCountStartDown = true;
    }
        countDownTime = 0f;
    }
    private bool isCountStartDown = false;//是否开始倒计时
    public void SetCountDown(bool isOn, bool isReset = false)
    {
        isCountStartDown = isOn;
        if (isReset) countDownTime = 0;
    }
    float countDownTime = 0f;
    float countDownLimit = 5f;
    public ParticleSystem needClickPS;//提示点击按钮
    /// <summary>
    /// This function is called every fixed framerate frame, if the MonoBehaviour is enabled.
    /// </summary>
    void FixedUpdate()
    {
        if (isCountStartDown)
        {
            countDownTime += Time.deltaTime;
            Debug.Log("倒计时中");
            if (countDownTime > countDownLimit)
            {
                CheckTower();
                countDownTime = 0;
            }
        }
    }
    /// <summary>
    /// 查看是否满足播放按钮提示
    /// </summary>
    private void CheckTower()
    {
        Debug.Log("判断是否提示");
        //条件 金币是否满足,合成区是否有位置
        int result;
        int.TryParse(cashText.text.ToString(), out result);
        int current = EndlessLevelManager.instance.Currency.currentCurrency;
        int num = EndlessGameUI.instance.GetTowerNum();
        if (current >= result && num < 10)//自己的钱多
        {
            isCountStartDown = false;
            needClickPS.Play();
        }
    }
    private void CheckCurrencyEnough()
    {
        int result;