| | |
| | | /// <summary> |
| | | /// 等待购买开启对应按钮. |
| | | /// </summary> |
| | | public Button waitBuyBtnPrefab; |
| | | public GameObject waitBuyBtnPrefab; |
| | | |
| | | /// <summary> |
| | | /// 最后一行格子与前一行格子之间的空位长度. |
| | |
| | | m_arrTGO = new EndlessTowerGridOpen[dimensions.x, dimensions.y]; |
| | | |
| | | GameObject container = GameObject.Find("BuyButtonContainer"); |
| | | float[] xup = { -0.6f, -0.3f, 0, 0.3f, 0.6f }; |
| | | //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; |
| | |
| | | |
| | | arrTowerEnergyEffect[x, y] = Instantiate(energyEffectPrefab); |
| | | arrTowerEnergyEffect[x, y].transform.position = vpos; |
| | | |
| | | |
| | | // 创建水精灵充能条 |
| | | img = Instantiate(FreezeBreathChargePrefab); |
| | | img.transform.SetParent(container.transform); |