| | |
| | | /// </summary> |
| | | public Button randomTowerBtn; |
| | | |
| | | public Button SkillTowerBtn; |
| | | |
| | | /// <summary> |
| | | /// 飘血数字对应的prefab. |
| | | /// </summary> |
| | |
| | | /// 购买塔防按钮上的Text. |
| | | /// </summary> |
| | | protected TextMeshProUGUI towerPriceText; |
| | | |
| | | protected TextMeshProUGUI towerPriceText1; |
| | | |
| | | protected bool tdBuyDisable = false; |
| | | |
| | |
| | | /// </summary> |
| | | public GameObject TowerAppearEffectPrefab; |
| | | |
| | | public GameObject TowerUpgradeEffectPrefabGuide;//新手导航特效Layer是UI |
| | | public GameObject TowerAppearEffectPrefabGuide;//新手导航特效Layer是UI |
| | | |
| | | |
| | | //首次购买宝石特效 |
| | | public GameObject fireAppearEffect1; |
| | | public GameObject fireAppearEffect2; |
| | |
| | | public GameObject woodAppearEffect1; |
| | | public GameObject woodAppearEffect2; |
| | | /// <summary> |
| | | /// 保存所有生成或合成的塔的最小等级,索引0 -> 火木水塔 索引1 -> 技能塔 |
| | | /// 保存所有生成或合成的塔的最小等级 |
| | | /// </summary> |
| | | /// <value></value> |
| | | public int MinLevel; |
| | |
| | | /// <param name="tower"></param> |
| | | protected void growUpTower(Tower tower) |
| | | { |
| | | Tower newTower = EndlessRandomTower.instance.GetRandomTower(false); |
| | | Tower newTower = EndlessRandomTower.instance.GetRandomTower(EFeatureTower.NULL, true); |
| | | |
| | | // 所有的Tower不能升级成为FeatureTower. |
| | | int maxLoop = 20; |
| | | while (newTower.towerFeature != EFeatureTower.NULL) |
| | | { |
| | | newTower = EndlessRandomTower.instance.GetRandomTower(false); |
| | | newTower = EndlessRandomTower.instance.GetRandomTower(EFeatureTower.NULL, true); |
| | | maxLoop--; |
| | | if (maxLoop <= 0) |
| | | { |
| | |
| | | { |
| | | if (m_CurrentTower.controller.towerFeature == EFeatureTower.NULL) |
| | | { |
| | | List<IntVector2> allTowerP = new List<IntVector2>(); |
| | | List<IntVector2> allPSTowerP = new List<IntVector2>();//需要播放升级动画的 |
| | | // List<IntVector2> allTowerP = new List<IntVector2>();//排除不能合成的 |
| | | // List<IntVector2> allPSTowerP = new List<IntVector2>();//需要播放升级动画的 |
| | | |
| | | for (int i = 0; i < m_listTower.Count; i++) |
| | | { |
| | | if (m_listTower[i].bInAttackMode && towerToMove && m_listTower[i].currentLevel == dragTowerLevel && m_listTower[i].towerName == towerToMove.towerName) |
| | | { |
| | | if (towerToMove.gridPosition != m_listTower[i].gridPosition) |
| | | //说明可以合成 |
| | | allPSTowerP.Add(m_listTower[i].gridPosition); |
| | | } |
| | | else |
| | | { |
| | | //把不符合条件的传进去 |
| | | allTowerP.Add(m_listTower[i].gridPosition); |
| | | } |
| | | } |
| | | // for (int i = 0; i < m_listTower.Count; i++) |
| | | // { |
| | | // if (m_listTower[i].bInAttackMode && towerToMove && m_listTower[i].currentLevel == dragTowerLevel && m_listTower[i].towerName == towerToMove.towerName) |
| | | // { |
| | | // if (towerToMove.gridPosition != m_listTower[i].gridPosition) |
| | | // //说明可以合成 |
| | | // allPSTowerP.Add(m_listTower[i].gridPosition); |
| | | // } |
| | | // else |
| | | // { |
| | | // //把不符合条件的传进去 |
| | | // allTowerP.Add(m_listTower[i].gridPosition); |
| | | // } |
| | | // } |
| | | if (m_CurrentArea != null) |
| | | { |
| | | (m_CurrentArea as TowerPlacementGridEndless).CheckAllCanPlace(allTowerP); |
| | | //修改为只要开启格子都可以放 |
| | | (m_CurrentArea as TowerPlacementGridEndless).CheckAllCanPlace(null); |
| | | //(m_CurrentArea as TowerPlacementGridEndless).PlayPS(allPSTowerP); |
| | | } |
| | | |
| | | |
| | | } |
| | | else if (m_CurrentTower.controller.towerFeature == EFeatureTower.Skill_Fire || m_CurrentTower.controller.towerFeature == EFeatureTower.Skill_Bomb) |
| | |
| | | |
| | | // 判断目标位置是否有Tower且类型和等级一致,如果没有,则GhostTower删除,原Tower显示。 |
| | | if (isValidateCombineTarget(pointerInfo)) |
| | | { |
| | | TryPlaceTower(pointerInfo); |
| | | EndlessRandomTower.instance.UpdateDescDisplay(); |
| | | } |
| | | else if (isFreeAttackGrid(pointerInfo) && !bSkill) |
| | | { |
| | | if (!TryPlaceTower(pointerInfo, false, true)) |
| | | { |
| | | CancelPlaceTower(pointerInfo); |
| | | CancelPlaceTower(pointerInfo); |
| | | |
| | | Debug.Log("这里需要返回原位"); |
| | | return; |
| | |
| | | Destroy(obj, ps.main.duration); |
| | | } |
| | | |
| | | public void PlayAppearEffectGuide(Vector3 worldPos) |
| | | { |
| | | GameObject obj = Instantiate(TowerAppearEffectPrefabGuide); |
| | | obj.transform.position = worldPos; |
| | | |
| | | Vector3 pos = obj.transform.position; |
| | | pos.y += 5f; |
| | | obj.transform.position = pos; |
| | | |
| | | ParticleSystem ps = obj.GetComponent<ParticleSystem>(); |
| | | |
| | | if (ps == null) |
| | | ps = obj.transform.GetChild(0).GetComponent<ParticleSystem>(); |
| | | |
| | | ps.Play(); |
| | | |
| | | Destroy(obj, ps.main.duration); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 播放宝石出现特效 |
| | | /// </summary> |
| | |
| | | Destroy(obj, ps.main.duration); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 播放升级特效 |
| | | /// </summary> |
| | | /// <param name="worldPos"></param> |
| | | public void GuidePlayUpgradeEffect(Vector3 position) |
| | | { |
| | | GameObject effect = TowerUpgradeEffectPrefab; |
| | | |
| | | // 在sTower的位置播放升级特效 |
| | | GameObject obj = Instantiate(effect); |
| | | GameObject obj = Instantiate(TowerUpgradeEffectPrefabGuide); |
| | | obj.transform.position = position; |
| | | |
| | | Vector3 pos = obj.transform.position; |
| | | pos.y += 5f; |
| | | obj.transform.position = pos; |
| | |
| | | |
| | | if (ps == null) |
| | | ps = obj.transform.GetChild(0).GetComponent<ParticleSystem>(); |
| | | |
| | | ps.Play(); |
| | | Destroy(obj, ps.main.duration); |
| | | } |
| | |
| | | if (!towerPriceText) |
| | | { |
| | | towerPriceText = randomTowerBtn.transform.Find("cashText").GetComponent<TextMeshProUGUI>(); |
| | | towerPriceText1 = SkillTowerBtn.transform.Find("cashText").GetComponent<TextMeshProUGUI>(); |
| | | if (towerPriceText) |
| | | towerPriceText.text = tpMgr.currentTowerPrice.ToString(); |
| | | if (towerPriceText1) |
| | | towerPriceText1.text = tpMgr.currentTowerPrice.ToString(); |
| | | } |
| | | else |
| | | { |
| | | towerPriceText.text = tpMgr.currentTowerPrice.ToString(); |
| | | towerPriceText1.text = tpMgr.currentTowerPrice.ToString(); |
| | | } |
| | | |
| | | // 无法支付新的塔防价格,按钮变灰. |
| | |
| | | if (towerPriceText) |
| | | { |
| | | towerPriceText.color = new Color(0.5f, 0.5f, 0.5f); |
| | | towerPriceText1.color = new Color(0.5f, 0.5f, 0.5f); |
| | | } |
| | | tdBuyDisable = true; |
| | | } |
| | |
| | | return; |
| | | |
| | | if (towerPriceText) |
| | | { |
| | | towerPriceText.color = new Color(1.0f, 1.0f, 1.0f); |
| | | towerPriceText1.color = new Color(1.0f, 1.0f, 1.0f); |
| | | } |
| | | |
| | | if (randomTowerBtn) |
| | | { |
| | |
| | | bool successfulPurchase = EndlessLevelManager.instance.Currency.TryPurchase(cost); |
| | | if (!successfulPurchase) return false; |
| | | |
| | | EndlessRandomTower.instance.UpdateDescDisplay(); |
| | | SetUpGhostTower(tow); |
| | | //Debug.Log("设置影子塔防."); |
| | | m_CurrentTower.Show(); |
| | |
| | | } |
| | | //selEff.SetWaveLineSel(true); |
| | | } |
| | | else |
| | | { |
| | | if (currentEffect != null) |
| | | { |
| | | currentEffect.SetParticleSystem(false); |
| | | currentEffect = null; |
| | | } |
| | | } |
| | | } |
| | | // 炸弹是区域攻击显示: |
| | | else if (m_CurrentTower.controller.towerFeature == EFeatureTower.Skill_Bomb) |