wangguan
2020-11-17 3da3d10bfdd30a1ad7f8c48ab9fd7e7745e3d053
Assets/Scripts/TowerDefense/Towers/Placement/TowerPlacementGridEndless.cs
@@ -37,7 +37,7 @@
        /// <summary>
        /// 等待购买开启对应按钮.
        /// </summary>
        public Button waitBuyBtnPrefab;
        public GameObject waitBuyBtnPrefab;
        /// <summary>
        /// 最后一行格子与前一行格子之间的空位长度.
@@ -629,27 +629,30 @@
            m_arrTGO = new EndlessTowerGridOpen[dimensions.x, dimensions.y];
            GameObject container = GameObject.Find("BuyButtonContainer");
            float[] xup = { -0.6f, -0.3f, 0, 0.3f, 0.6f };
            TowerPlacementGridEndless.GRID_OPENCASH = 100;
            //Debug.Log("修改了数值:" + TowerPlacementGridEndless.GRID_OPENCASH);
            //float[] xup = { -0.6f, -0.3f, 0, 0.3f, 0.6f };
            for (int x = 0; x < dimensions.x; ++x)
            {
                for (int y = dimensions.y - AttackRowNumbers; y < dimensions.y; ++y)
                {
                    if (m_arrGridType[x, y] != PlacementGridType.EGridWaitBuy) continue;
                    Button buyButton = Instantiate(waitBuyBtnPrefab);
                    GameObject buyButton = Instantiate(waitBuyBtnPrefab);
                    buyButton.transform.SetParent(container.transform);
                    Vector3 pos = buyButton.transform.position;
                    pos.x = arrGridCentPos[x, y].x + (x - 2) * gapArr[3 - y] + xup[x];
                    if (y == 2)
                    {
                        pos.z = arrGridCentPos[x, y].y + 9f;
                    }
                    else if (y == 3)
                    {
                        pos.z = arrGridCentPos[x, y].y + 7f;
                    }
                    //pos.x = arrGridCentPos[x, y].x + (x - 2) * gapArr[3 - y] + xup[x];
                    pos.x = arrGridCentPos[x, y].x + (x - 2) * gapArr[3 - y];
                    pos.z = arrGridCentPos[x, y].y + 6f;
                    // if (y == 2)
                    // {
                    //     pos.z = arrGridCentPos[x, y].y + 9f;
                    // }
                    // else if (y == 3)
                    // {
                    //     pos.z = arrGridCentPos[x, y].y + 7f;
                    // }
                    pos.y = 30;
                    buyButton.transform.position = pos;
                    buyButton.transform.localRotation = Quaternion.identity;
@@ -774,7 +777,7 @@
                    arrTowerEnergyEffect[x, y] = Instantiate(energyEffectPrefab);
                    arrTowerEnergyEffect[x, y].transform.position = vpos;
                    // 创建水精灵充能条
                    img = Instantiate(FreezeBreathChargePrefab);
                    img.transform.SetParent(container.transform);
@@ -1033,27 +1036,27 @@
        /// <param name="allTowerP"></param>
        public void PlayPS(List<IntVector2> allTowerP)
        {
            for (int i = 0; i < allTowerP.Count; i++)
            {
                m_Tiles[allTowerP[i].x, allTowerP[i].y].SetParticleSystem(true);
            }
            // for (int i = 0; i < allTowerP.Count; i++)
            // {
            //     m_Tiles[allTowerP[i].x, allTowerP[i].y].SetParticleSystem(true);
            // }
        }
        /// <summary>
        /// /// 停止所有升级动画
        /// </summary>
        public void StopPS()
        {
            int iy = dimensions.y - 1;//3
            for (int ix = 0; ix < dimensions.x; ix++)
            {
                for (int y = iy; y >= dimensions.y - AttackRowNumbers; --y)
                {
                    if (m_arrGridType[ix, y] == PlacementGridType.EGridOpen)
                    {
                        m_Tiles[ix, y].SetParticleSystem(false);
                    }
                }
            }
            // int iy = dimensions.y - 1;//3
            // for (int ix = 0; ix < dimensions.x; ix++)
            // {
            //     for (int y = iy; y >= dimensions.y - AttackRowNumbers; --y)
            //     {
            //         if (m_arrGridType[ix, y] == PlacementGridType.EGridOpen)
            //         {
            //             m_Tiles[ix, y].SetParticleSystem(false);
            //         }
            //     }
            // }
        }
        /// <summary>
@@ -1100,7 +1103,7 @@
                    }
                }
            }
            StopPS();
            //StopPS();
        }
#if UNITY_EDITOR