| | |
| | | |
| | | private EnergyUICtl[,] arrTowerEnergyUi; |
| | | |
| | | private ParticleSystem[,] arrTowerEnergyEffect; |
| | | |
| | | /// <summary> |
| | | /// 充能特效对应的Prefab. |
| | | /// </summary> |
| | | public ParticleSystem energyEffectPrefab; |
| | | |
| | | /// <summary> |
| | | /// 此位置上塔对应的子弹充能Prefab.塔放置到当前的塔位后,如果是对应的塔防类型,需要把 |
| | | /// 相应的界面指针传到塔防的数据结构内。 |
| | |
| | | m_arrTowerBulletUIPos = new Vector2[dimensions.x, AttackRowNumbers]; |
| | | arrTowerBulletUi = new BulletUICtl[dimensions.x, AttackRowNumbers]; |
| | | arrTowerEnergyUi = new EnergyUICtl[dimensions.x, AttackRowNumbers]; |
| | | arrTowerEnergyEffect = new ParticleSystem[dimensions.x, AttackRowNumbers]; |
| | | |
| | | for (int x = 0; x < dimensions.x; x++) |
| | | { |
| | |
| | | img.transform.SetParent(container.transform, true); |
| | | tpos = img.transform.position; |
| | | tpos.x = m_arrTowerBulletUIPos[x, y].x + 4.2f; |
| | | tpos.z = m_arrTowerBulletUIPos[x, y].y + 1.1f - y * 1.66f; |
| | | tpos.z = m_arrTowerBulletUIPos[x, y].y + 1.1f - y * 1.66f; |
| | | tpos.y = 30f; |
| | | img.transform.position = tpos; |
| | | img.transform.localScale = Vector3.one; |
| | |
| | | EnergyUICtl euc = img.GetComponent<EnergyUICtl>(); |
| | | arrTowerEnergyUi[x, y] = euc; |
| | | euc.gameObject.SetActive(false); |
| | | |
| | | // 设置播放特效对应的3D坐标: |
| | | Vector3 vpos = GridToWorld(new IntVector2(x, dy - y), new IntVector2(2, 1)); |
| | | vpos.x -= (gridSize / 2.0f); |
| | | vpos.y += 5.0f; |
| | | |
| | | arrTowerEnergyEffect[x, y] = Instantiate(energyEffectPrefab); |
| | | arrTowerEnergyEffect[x, y].transform.position = vpos; |
| | | arrTowerEnergyEffect[x, y].Stop(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void updateGridOpenCoin(int ix, int iy) |
| | | { |
| | | GRID_OPENCASH += GRID_OPENCASH; |
| | | GRID_OPENCASH = Mathf.Floor(GRID_OPENCASH * 1.2f); |
| | | |
| | | for (int x = 0; x < dimensions.x; x++) |
| | | { |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 在指定的位置播放充能成功的特效. |
| | | /// </summary> |
| | | /// <param name="x"></param> |
| | | /// <param name="y"></param> |
| | | /// <param name="play">是播放还是停止播放</param> |
| | | public void PlayEnergyEffect(int x, int y, bool play = true) |
| | | { |
| | | int dy = dimensions.y - 1 - y; |
| | | |
| | | if (!arrTowerEnergyEffect[x, dy]) return; |
| | | |
| | | if (play) |
| | | arrTowerEnergyEffect[x, dy].Play(); |
| | | else |
| | | arrTowerEnergyEffect[x, dy].Stop(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Set collider's size and center |
| | | /// </summary> |
| | | void ResizeCollider() |