| | |
| | | using TMPro.Examples; |
| | | using TowerDefense.Level; |
| | | using TowerDefense.UI.HUD; |
| | | using UnityEditor; |
| | | using UnityEngine; |
| | | using UnityEngine.Analytics; |
| | | using UnityEngine.UI; |
| | |
| | | /// </summary> |
| | | public Button waitBuyBtnPrefab; |
| | | |
| | | // TEST CODE: |
| | | /// <summary> |
| | | /// 充能特效对应的Prefab. |
| | | /// </summary> |
| | | public ParticleSystem energyEffectPrefab; |
| | | |
| | | // TEST CODE TO DELETE: |
| | | public ParticleSystem TestParticle; |
| | | protected ParticleSystem PlayParticle; |
| | | protected Timer effectStopTimer; |
| | |
| | | Vector2[] m_arrTowerBulletUIPos; |
| | | BulletUICtl[] arrTowerBulletUi; |
| | | EnergyUICtl[] arrTowerEnergyUi; |
| | | ParticleSystem[] arrTowerEnergyEffect; |
| | | |
| | | |
| | | /// <summary> |
| | |
| | | } |
| | | } |
| | | |
| | | void Update() |
| | | protected void partilceUpdate() |
| | | { |
| | | /* if (bTimerStart) |
| | | if (bTimerStart) |
| | | { |
| | | if (effectStopTimer.Tick(Time.deltaTime)) |
| | | { |
| | | bTimerStart = false; |
| | | effectStopTimer.Reset(); |
| | | } |
| | | } |
| | | |
| | | if (UnityEngine.Input.GetKeyDown(KeyCode.Q)) |
| | | { |
| | | this.PlayEnergyEffect(2, true); |
| | | return; |
| | | } |
| | | if (UnityEngine.Input.GetKeyDown(KeyCode.W)) |
| | | { |
| | | this.PlayEnergyEffect(2, false); |
| | | return; |
| | | } |
| | | |
| | | // TEST CODE TO DELETE: |
| | |
| | | if (UnityEngine.Input.GetKeyDown(KeyCode.E)) |
| | | { |
| | | PlayParticle = Instantiate(TestParticle); |
| | | PlayParticle.transform.position = this.transform.position; |
| | | Vector3 lookVec = Vector3.zero; |
| | | lookVec.x = 1; |
| | | PlayParticle.transform.LookAt(lookVec); |
| | | Vector3 tpos = this.transform.position; |
| | | tpos.y += 5.0f; |
| | | PlayParticle.transform.position = tpos; |
| | | |
| | | //Vector3 lookVec = Vector3.zero; |
| | | //lookVec.x = 1; |
| | | //PlayParticle.transform.LookAt(lookVec); |
| | | PlayParticle.Play(); |
| | | effectStopTimer.SetTime( 0.15f ); |
| | | bTimerStart = true; |
| | | //effectStopTimer.SetTime(0.15f); |
| | | //bTimerStart = true; |
| | | } |
| | | if (UnityEngine.Input.GetKeyDown(KeyCode.F)) |
| | | { |
| | | PlayParticle.Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear); |
| | | } |
| | | }*/ |
| | | } |
| | | } |
| | | |
| | | void Update() |
| | | { |
| | | // |
| | | // TEST CODE TO DELETE: |
| | | partilceUpdate(); |
| | | |
| | | if (m_arrCoinGenTime == null) return; |
| | | |
| | |
| | | m_arrTowerBulletUIPos = new Vector2[dimensions.x]; |
| | | arrTowerBulletUi = new BulletUICtl[dimensions.x]; |
| | | arrTowerEnergyUi = new EnergyUICtl[dimensions.x]; |
| | | arrTowerEnergyEffect = new ParticleSystem[dimensions.x]; |
| | | |
| | | for (int x = 0; x < dimensions.x; x++) |
| | | { |
| | |
| | | img.transform.SetAsFirstSibling(); |
| | | EnergyUICtl euc = img.GetComponent<EnergyUICtl>(); |
| | | arrTowerEnergyUi[x] = euc; |
| | | // euc.gameObject.SetActive(false); |
| | | euc.gameObject.SetActive(false); |
| | | |
| | | // 设置播放特效对应的3D坐标: |
| | | Vector3 vpos = GridToWorld(new IntVector2(x, dy), new IntVector2(2, 1)); |
| | | vpos.x -= (gridSize / 2.0f); |
| | | vpos.y += 5.0f; |
| | | |
| | | arrTowerEnergyEffect[x] = Instantiate( energyEffectPrefab ); |
| | | arrTowerEnergyEffect[x].transform.position = vpos; |
| | | arrTowerEnergyEffect[x].Stop(); |
| | | } |
| | | |
| | | return; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 在指定的位置播放充能成功的特效. |
| | | /// </summary> |
| | | /// <param name="x"></param> |
| | | /// <param name="play">是播放还是停止播放</param> |
| | | public void PlayEnergyEffect( int x,bool play = true ) |
| | | { |
| | | if (!arrTowerEnergyEffect[x]) return; |
| | | if( play) |
| | | { |
| | | arrTowerEnergyEffect[x].Play(); |
| | | } |
| | | else |
| | | { |
| | | arrTowerEnergyEffect[x].Stop(); |
| | | } |
| | | return; |
| | | } |
| | | |
| | | |
| | | public void updateGridOpenCoin(int ix, int iy) |
| | | { |