| | |
| | | using TowerDefense.Level; |
| | | using KTGMGemClient; |
| | | using TowerDefense.UI.HUD; |
| | | using System.Collections; |
| | | |
| | | /// <summary> |
| | | /// 无尽模式用自己的EndlessUIStart |
| | |
| | | |
| | | private bool isPause; |
| | | |
| | | public bool beginSkillStep = false; |
| | | |
| | | // Start is called before the first frame update |
| | | void Start() |
| | | { |
| | | if (TDAA_SDKManager.Ins == null) |
| | | gameObject.AddComponent<TDAA_SDKManager>(); |
| | | TDAA_SDKManager.Ins.ArriveBattle();//埋点 |
| | | |
| | | TDAA_SDKManager.Ins.Statistics(4);//埋点 |
| | | |
| | | bVibrate = new bool[4]; |
| | | bVibrate[0] = bVibrate[1] = bVibrate[2] = bVibrate[3] = false; |
| | | |
| | |
| | | int guide = PlayerPrefs.GetInt("GemBattleGuide"); |
| | | GameConfig.IsNewbie = guide == 0; |
| | | |
| | | if (guide == 0) |
| | | if (GameConfig.IsNewbie) |
| | | { |
| | | Debug.Log("开始新手引导"); |
| | | Pause(); |
| | | uiStartMssk.gameObject.SetActive(false); |
| | | countDownTextNew.text = ""; |
| | |
| | | |
| | | Instantiate(Resources.Load<GameObject>("UI/Guide/GuidePanel"), this.transform); |
| | | AddGuideEvent(); |
| | | //bGameStart = true; |
| | | // 开始关卡 |
| | | //EndlessLevelManager.instance.StartLevel(); |
| | | //timeTextNew.gameObject.SetActive(true); |
| | | |
| | | // 开始播放背景音乐. |
| | | // if (bgMusic != null) |
| | | // bgMusic.Play(); |
| | | } |
| | | |
| | | GameConfig.EndlessOpenAttackTowerCount = 0; |
| | | GameConfig.EndlessBuyTowerCount = 0; |
| | | GameConfig.EndlessPortUseSkillTowerCount = 0; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | EventCenter.Ins.Add((int)KTGMGemClient.EventType.CreateWaterLv1, CreateWaterLv1); |
| | | EventCenter.Ins.Add((int)KTGMGemClient.EventType.CreateSecondWave, CreateSecondWave); |
| | | EventCenter.Ins.Add((int)KTGMGemClient.EventType.SkillRelease, SkillRelease); |
| | | EventCenter.Ins.Add((int)KTGMGemClient.EventType.GuideFinish, NewbieGuideEnd); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | EndlessGameUI.instance.PlaceTowerForce(aTower, new IntVector2(2, 3), 2); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 开始第一关的第一个波次 |
| | | /// </summary> |
| | | private void CreateFirstWave() |
| | | { |
| | | Restart(); |
| | | EventCenter.Ins.Add((int)KTGMGemClient.EventType.FireTowerChargeEnd, OnFireTowerChargeEnd); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 火塔充能释放完成 |
| | | /// </summary> |
| | | private void OnFireTowerChargeEnd() |
| | | { |
| | | Pause(); |
| | |
| | | EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.ChargingEnd); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 恢复波次 |
| | | /// </summary> |
| | | private void RestartWave() |
| | | { |
| | | Restart(); |
| | | EndlessLevelManager.instance.RestartWave(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获得金币 |
| | | /// </summary> |
| | | /// <param name="gold"></param> |
| | | private void AddGold(int gold) |
| | | { |
| | | EndlessLevelManager.instance.Currency.AddCurrency(gold); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 在攻击位置上创建一个1级的水塔 |
| | | /// </summary> |
| | | private void CreateWaterLv1() |
| | | { |
| | | Tower aTower = EndlessRandomTower.instance.getTowerByName("CopyCatTower"); |
| | | EndlessGameUI.instance.PlaceTowerForce(aTower, new IntVector2(1, 3), 1); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 开始第二关 |
| | | /// </summary> |
| | | private void CreateSecondWave() |
| | | { |
| | | |
| | | EndlessLevelManager.instance.NewbieUpdateLevel(); |
| | | beginSkillStep = true; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 在第三条兵线释放技能宝石 |
| | | /// </summary> |
| | | private void SkillRelease() |
| | | { |
| | | int attributeId = 99902; |
| | | int level = 1; |
| | | int waveLineIndex = 1; |
| | | |
| | | // 播放特效,并处理伤害. |
| | | EndlessWaveLineManager.instance.PlayWaveLineEffect(waveLineIndex); |
| | | AgentInsManager.instance.ExecWavelineAttack(waveLineIndex, attributeId, level, false); |
| | | ++GameConfig.EndlessPortUseSkillTowerCount; |
| | | StartCoroutine(Delay1()); |
| | | } |
| | | |
| | | private IEnumerator Delay1() |
| | | { |
| | | yield return new WaitForSeconds(1f); |
| | | EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.SkillReleaseDone); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 新手引导结束 |
| | | /// </summary> |
| | | private void NewbieGuideEnd() |
| | | { |
| | | EndlessLevelManager.instance.RestartWave(); |
| | | GameConfig.IsNewbie = false; |
| | | } |
| | | |
| | | /// <summary> |