public void setCurrentTowerInfo(TowerPassiveController towerController) { controller = towerController; Name.text = towerController.attribute.Name; value.text = towerController.passiveAttribute.Value.ToString(); updateTime.text = towerController.passiveAttribute.UpdateTime.ToString(); timeBuild.text = towerController.passiveAttribute.TimeBuild.ToString(); //Check bonus // if(ItemManager.Instance.listItemState.Contains(EItemState.ATK)) // ATK.text += " [8aff5c]+ " + towerController.Bonus.ATK + "[-]"; // if(ItemManager.Instance.listItemState.Contains(EItemState.SPAWN_SHOOT)) // spawnShoot.text += " [8aff5c]- " + towerController.Bonus.SpawnShoot + "[-]"; // if(ItemManager.Instance.listItemState.Contains(EItemState.RANGE)) // { // PlayManager playManager = PlayManager.Instance; // // playManager.rangeTowerBonus.transform.position = playManager.rangeTower.transform.position; // float scale = (float)(controller.attribute.Range + controller.Bonus.Range) / 100f; // playManager.rangeTowerBonus.transform.localScale = new Vector3(scale, scale, 0); // playManager.rangeTowerBonus.SetActive(true); // // ((SphereCollider)controller.collider).radius = controller.attribute.Range + controller.Bonus.Range; // } }
void getTowerPassiveDatabase() { int length = TowersPassive.Length; for (int i = 0; i < length; i++) { TowerPassiveController tower = TowersPassive[i].GetComponent <TowerPassiveController>(); TowerPassiveController tower2; while (true) { if (ReadDatabase.Instance.TowerPassiveInfo.ContainsKey(tower.ID.Type.ToString() + tower.ID.Level.ToString())) { TowerPassiveData data = ReadDatabase.Instance.TowerPassiveInfo[tower.ID.Type.ToString() + tower.ID.Level.ToString()]; tower.passiveAttribute.Cost = data.Cost; tower.passiveAttribute.UpdateTime = data.UpdateTime; tower.passiveAttribute.Value = data.Value; tower.passiveAttribute.TimeBuild = data.TimeBuild; tower.passiveAttribute.Describe = data.Describe; switch (data.Type) { case "IRON": tower.Branch = EBranchGame.IRON; break; case "PLANT": tower.Branch = EBranchGame.PLANT; break; case "ICE": tower.Branch = EBranchGame.ICE; break; case "FIRE": tower.Branch = EBranchGame.FIRE; break; case "EARTH": tower.Branch = EBranchGame.EARTH; break; } } if (tower.nextLevel) { tower2 = (TowerPassiveController)tower.nextLevel; tower = tower2; } else { break; } } } }
// set info tower public void setTowerInfo(TowerPassiveController towerController) { isOnTowerInfo = true; childTowerInfo.SetActive(true); if (childDragonInfo != null) { childDragonInfo.SetActive(false); } controller = towerController; sellLabel.text = (towerController.totalMoney / 2).ToString(); Name.text = towerController.attribute.Name; value.text = towerController.passiveAttribute.Value.ToString(); updateTime.text = towerController.passiveAttribute.UpdateTime.ToString(); timeBuild.text = towerController.passiveAttribute.TimeBuild.ToString(); typeTower.text = towerController.passiveAttribute.Type.ToString(); value.parent.transform.GetComponentInChildren <UISprite> ().spriteName = "icon-gold"; //Set color tower name Color[] colors = PlayConfig.getColorTowerName(towerController.ID); Name.color = colors[0]; Name.effectColor = colors[1]; if (towerController.nextLevel == null) { //Khóa upgrade lockUpgrade(true); TowerInfoController.isLock = true; } else { upgradeLabel.text = towerController.nextLevel.attribute.Cost.ToString(); } //Check bonus // if(ItemManager.Instance.listItemState.Contains(EItemState.ATK)) // ATK.text += " [8aff5c]+ " + towerController.Bonus.ATK + "[-]"; // if(ItemManager.Instance.listItemState.Contains(EItemState.SPAWN_SHOOT)) // spawnShoot.text += " [8aff5c]- " + towerController.Bonus.SpawnShoot + "[-]"; // if(ItemManager.Instance.listItemState.Contains(EItemState.RANGE)) // { // PlayManager playManager = PlayManager.Instance; // // playManager.rangeTowerBonus.transform.position = playManager.rangeTower.transform.position; // float scale = (float)(towerController.attribute.Range + towerController.Bonus.Range) / 100f; // playManager.rangeTowerBonus.transform.localScale = new Vector3(scale, scale, 0); // playManager.rangeTowerBonus.SetActive(true); // // ((SphereCollider)controller.collider).radius = controller.attribute.Range + controller.Bonus.Range; // } }
// set info tower public void setTowerInfo(TowerPassiveController towerController) { isOnTowerInfo = true; childTowerInfo.SetActive(true); if(childDragonInfo != null) childDragonInfo.SetActive(false); controller = towerController; sellLabel.text = (towerController.totalMoney / 2).ToString(); Name.text = towerController.attribute.Name; value.text = towerController.passiveAttribute.Value.ToString(); updateTime.text = towerController.passiveAttribute.UpdateTime.ToString(); timeBuild.text = towerController.passiveAttribute.TimeBuild.ToString (); typeTower.text = towerController.passiveAttribute.Type.ToString (); value.parent.transform.GetComponentInChildren<UISprite> ().spriteName = "icon-gold"; //Set color tower name Color[] colors = PlayConfig.getColorTowerName(towerController.ID); Name.color = colors[0]; Name.effectColor = colors[1]; if(towerController.nextLevel == null) { //Khóa upgrade lockUpgrade(true); TowerInfoController.isLock = true; } else upgradeLabel.text = towerController.nextLevel.attribute.Cost.ToString(); //Check bonus // if(ItemManager.Instance.listItemState.Contains(EItemState.ATK)) // ATK.text += " [8aff5c]+ " + towerController.Bonus.ATK + "[-]"; // if(ItemManager.Instance.listItemState.Contains(EItemState.SPAWN_SHOOT)) // spawnShoot.text += " [8aff5c]- " + towerController.Bonus.SpawnShoot + "[-]"; // if(ItemManager.Instance.listItemState.Contains(EItemState.RANGE)) // { // PlayManager playManager = PlayManager.Instance; // // playManager.rangeTowerBonus.transform.position = playManager.rangeTower.transform.position; // float scale = (float)(towerController.attribute.Range + towerController.Bonus.Range) / 100f; // playManager.rangeTowerBonus.transform.localScale = new Vector3(scale, scale, 0); // playManager.rangeTowerBonus.SetActive(true); // // ((SphereCollider)controller.collider).radius = controller.attribute.Range + controller.Bonus.Range; // } }
public void loadInfoTowerPassive() { if (target != null) { //AutoDestroy.destroyChildren(infoPanel, PlayNameHashIDs.Collider); //active tower name if (!labelTowerName.gameObject.activeSelf) { labelTowerName.gameObject.SetActive(true); } TowerShopController targetController = target.GetComponent <TowerShopController>(); labelTowerName.text = targetController.Name.text.ToUpper() + " TOWER"; //Set towe name color Color[] nameColor = PlayConfig.getColorTowerName(targetController.ID); labelTowerName.color = nameColor[0]; labelTowerName.effectColor = nameColor[1]; STowerID towerID = targetController.ID; GameObject[] towersPassive = ObjectManager.Instance.TowersPassive; int length = towersPassive.Length; int count = 0; for (int i = 0; i < length; i++) { TowerPassiveController towerController = towersPassive[i].GetComponent <TowerPassiveController>(); if (towerController.ID.Type == towerID.Type && towerController.ID.Level == towerID.Level) { while (true) { GameObject info = Instantiate(towerInfoModel) as GameObject; info.transform.parent = infoPanel.transform; info.transform.localScale = Vector3.one; info.name = towerController.name; UIAnchor anchor = info.GetComponent <UIAnchor>(); anchor.container = infoPanel.gameObject; anchor.relativeOffset = new Vector2(0, PlayConfig.InfoShopAnchor.PanelAnchorStart - count * PlayConfig.InfoShopAnchor.PanelAnchorDistance); #region TOWER TowerShopInfoController infoController = info.GetComponent <TowerShopInfoController>(); infoController.icon.mainTexture = Resources.Load <Texture>(PlayConfig.getTowerIcon(towerID)); infoController.level.text = "Level " + ((int)towerID.Level).ToString(); infoController.atk.text = towerController.attribute.MinATK.ToString() + " - " + towerController.attribute.MaxATK.ToString(); infoController.spawnShoot.text = towerController.attribute.SpawnShoot.ToString(); infoController.timeBuild.text = towerController.attribute.TimeBuild.ToString(); //Bullet label string[] str = PlayConfig.getBulletType(towerController.attackType.ToString()); infoController.bulletAbility.text = str[0] + " TARGET"; infoController.bulletRegion.text = str[1]; //set icon fix size infoController.icon.keepAspectRatio = UIWidget.AspectRatioSource.Free; Vector2 localSize = new Vector2(infoController.icon.mainTexture.width, infoController.icon.mainTexture.height); infoController.icon.SetDimensions((int)localSize.x, (int)localSize.y); infoController.icon.keepAspectRatio = UIWidget.AspectRatioSource.BasedOnHeight; UIStretch uiStretch = infoController.icon.GetComponent <UIStretch>(); uiStretch.enabled = true; #endregion #region BULLET object[] bulletData = PlayConfig.getBulletShop(towerID); SAnchor bulletTowerShop = (SAnchor)bulletData[1]; infoController.bulletIcon.mainTexture = Resources.Load <Texture>("Image/Bullet/Bullet Icon/" + bulletData[0].ToString()); infoController.bulletIcon.keepAspectRatio = UIWidget.AspectRatioSource.Free; infoController.bulletIcon.SetDimensions(infoController.bulletIcon.mainTexture.width, infoController.bulletIcon.mainTexture.height); infoController.bulletIcon.keepAspectRatio = UIWidget.AspectRatioSource.BasedOnHeight; UIStretch stretch = infoController.bulletIcon.GetComponent <UIStretch>(); stretch.relativeSize.y = bulletTowerShop.Stretch; stretch.enabled = true; //Add effect infoController.bullet = towerController.bullet; #endregion count++; //get Next Tower if (towerController.nextLevel != null) { towerID = towerController.nextLevel.GetComponent <TowerPassiveController>().ID; towerController = towerController.nextLevel as TowerPassiveController; } else { break; } } break; } } } }
public void loadTowerPassive() { if (shopType == EShopType.TOWER) { return; } shopType = EShopType.TOWER; target = null; //AutoDestroy.destroyChildren(towerPanel, PlayNameHashIDs.Collider); //towerPanel.transform.localPosition = Vector3.zero; //towerPanel.GetComponent<UIPanel>().clipOffset = Vector2.zero; setSpriteButton(EShopType.TOWER); int TowersLength = ObjectManager.Instance.Towers.Length; int length = ObjectManager.Instance.TowersPassive.Length; for (int i = 0; i < length; i++) { TowerPassiveController currentTower = ObjectManager.Instance.TowersPassive[i].GetComponent <TowerPassiveController>(); GameObject _towerShop = Instantiate(towerShopModel) as GameObject; _towerShop.transform.parent = towerPanel.transform; _towerShop.transform.localScale = Vector3.one; _towerShop.name = currentTower.name; UIAnchor anchor = _towerShop.GetComponent <UIAnchor>(); anchor.container = towerPanel.gameObject; anchor.relativeOffset = new Vector2(PlayConfig.TowerShopAnchor.PanelAnchorStart + (i + TowersLength) * PlayConfig.TowerShopAnchor.PanelAnchorDistance, 0); TowerShopController towerShopController = _towerShop.GetComponent <TowerShopController>(); towerShopController.Index = i; towerShopController.ID = currentTower.ID; towerShopController.Name.text = currentTower.attribute.Name.Split()[0]; //set background stretch foreach (Transform child in _towerShop.transform) { if (child.name == "Background") { child.GetComponent <UIStretch>().container = towerPanel; break; } } //set diamond and gold STowerCost cost = ReadDatabase.Instance.TowerCostInfo[towerShopController.ID.Type.ToString()]; towerShopController.Money = cost.Gold; towerShopController.Diamond = cost.Diamond; string s = GameConfig.PathTowerIcon + currentTower.ID.Type.ToString() + "-" + currentTower.ID.Level; towerShopController.icon.mainTexture = Resources.Load <Texture>(s); towerShopController.setColor(false); towerShopController.icon.keepAspectRatio = UIWidget.AspectRatioSource.Free; Vector2 localSize = new Vector2(towerShopController.icon.mainTexture.width, towerShopController.icon.mainTexture.height); towerShopController.icon.SetDimensions((int)localSize.x, (int)localSize.y); towerShopController.icon.keepAspectRatio = UIWidget.AspectRatioSource.BasedOnHeight; UIStretch uiStretch = towerShopController.icon.GetComponent <UIStretch>(); uiStretch.enabled = true; if (target == null) { target = _towerShop; } if (!initWhenStart) { towerShopType[i] = WaveController.Instance.infoMap.TowerUsed.ToUpper().Contains(currentTower.ID.Type.ToString()) ? ETowerShopState.TOWER_BUY_DEFAULT : ETowerShopState.TOWER_BUY_ENABLE; } _towerShop.GetComponentInChildren <UITowerShop>().type = towerShopType[i]; } if (target != null) { target.GetComponentInChildren <TowerShopController>().setColor(true); } loadInfoTowerPassive(); if (!initWhenStart) { initWhenStart = true; } }
public override void Start() { base.Start(); towerPassiveController = GetComponent<TowerPassiveController>(); }
public override void Start() { base.Start(); towerPassiveController = GetComponent <TowerPassiveController>(); }
public void setNextTowerInfo(TowerPassiveController towerController) { controller = towerController; Name.text = towerController.attribute.Name; value.text = towerController.passiveAttribute.Value.ToString(); updateTime.text = towerController.passiveAttribute.UpdateTime.ToString (); timeBuild.text = towerController.passiveAttribute.TimeBuild.ToString (); //Check bonus // if(ItemManager.Instance.listItemState.Contains(EItemState.ATK)) // { // ATK.text += " [8aff5c]+ " + (int)((towerController.attribute.MinATK + towerController.attribute.MaxATK) * ItemManager.Instance.BonusATK / 2) + "[-]"; // } // if(ItemManager.Instance.listItemState.Contains(EItemState.SPAWN_SHOOT)) // { // spawnShoot.text += " [8aff5c]- " + towerController.attribute.SpawnShoot * ItemManager.Instance.BonusSpawnShoot + "[-]"; // } // if(ItemManager.Instance.listItemState.Contains(EItemState.RANGE)) // { // PlayManager playManager = PlayManager.Instance; // // playManager.rangeTowerBonus.transform.position = playManager.rangeTower.transform.position; // float scale = (float)(controller.attribute.Range + (int)(towerController.attribute.Range * ItemManager.Instance.BonusRange)) / 100f; // playManager.rangeTowerBonus.transform.localScale = new Vector3(scale, scale, 0); // playManager.rangeTowerBonus.SetActive(true); // } }
public void loadTower() { AutoDestroy.destroyChildren(selectedRegionPanel); infoTower.gameObject.SetActive(true); infoEnemy.gameObject.SetActive(false); target = null; guideType = UIGuideButton.TOWER; //set grid UIGrid grid = selectedRegionPanel.GetComponent <UIGrid>(); grid.maxPerLine = PlayConfig.GridGuideTower.MaxPerLine; grid.cellWidth = PlayConfig.GridGuideTower.CellWidth; grid.cellHeight = PlayConfig.GridGuideTower.CellHeight; grid.enabled = true; grid.repositionNow = true; int length = ObjectManager.Instance.Towers.Length; for (int i = 0; i < length; i++) { TowerController towerController = ObjectManager.Instance.Towers[i].GetComponent <TowerController>(); GameObject towerGuide = Instantiate(PlayManager.Instance.modelPlay.TowerGuide) as GameObject; towerGuide.transform.parent = selectedRegionPanel.transform; towerGuide.GetComponent <UIStretch>().container = selectedRegionPanel; towerGuide.GetComponentInChildren <TowerGuideController>().ID = towerController.ID; //Set icon towerGuide.GetComponent <UISprite>().spriteName = "tower-info-" + towerController.ID.Type.ToString().ToLower(); towerGuide.name = towerController.ID.Type.ToString(); //Set name string name = towerController.ID.Type.ToString(); UILabel label = towerGuide.GetComponentInChildren <UILabel>(); label.text = name[0] + name.Substring(1, name.Length - 1).ToLower(); //Set color Color[] colors = PlayConfig.getColorTowerName(towerController.ID); label.color = colors[0]; label.effectColor = colors[1]; if (target == null) { target = towerGuide; } } if (target != null) { target.GetComponentInChildren <TowerGuideController>().setColor(true); } loadTowerInfo(); length = ObjectManager.Instance.TowersPassive.Length; for (int i = 0; i < length; i++) { TowerPassiveController towerController = ObjectManager.Instance.TowersPassive[i].GetComponent <TowerPassiveController>(); GameObject towerGuide = Instantiate(PlayManager.Instance.modelPlay.TowerGuide) as GameObject; towerGuide.transform.parent = selectedRegionPanel.transform; towerGuide.GetComponent <UIStretch>().container = selectedRegionPanel; towerGuide.GetComponentInChildren <TowerGuideController>().ID = towerController.ID; //Set icon towerGuide.GetComponent <UISprite>().spriteName = "tower-info-" + towerController.ID.Type.ToString().ToLower(); towerGuide.name = towerController.ID.Type.ToString(); //Set name string name = towerController.ID.Type.ToString(); UILabel label = towerGuide.GetComponentInChildren <UILabel>(); label.text = name[0] + name.Substring(1, name.Length - 1).ToLower(); //Set color Color[] colors = PlayConfig.getColorTowerName(towerController.ID); label.color = colors[0]; label.effectColor = colors[1]; if (target == null) { target = towerGuide; } } if (target != null) { target.GetComponentInChildren <TowerGuideController>().setColor(true); } loadTowerPassiveInfo(); }
public void loadTowerInfo() { ; if (target != null) { AutoDestroy.destroyChildren(infoTower, "Level"); //clear array listTower.Clear(); //active tower name if (!infoName.gameObject.activeSelf) { infoName.gameObject.SetActive(true); } TowerGuideController targetController = target.GetComponentInChildren <TowerGuideController>(); string name = targetController.ID.Type.ToString(); infoName.text = name[0] + name.Substring(1, name.Length - 1).ToLower() + " LV " + targetController.ID.Level; //Set towe name color Color[] nameColor = PlayConfig.getColorTowerName(targetController.ID); infoName.color = nameColor[0]; infoName.effectColor = nameColor[1]; STowerID towerID = targetController.ID; GameObject[] towers = ObjectManager.Instance.Towers; int length = towers.Length; int count = 0; for (int i = 0; i < length; i++) { TowerController towerController = towers[i].GetComponent <TowerController>(); if (towerController.ID.Type == towerID.Type && towerController.ID.Level == towerID.Level) { while (true) { GameObject info = Instantiate(PlayManager.Instance.modelPlay.TowerGuideInfo) as GameObject; info.transform.parent = infoTower.transform; info.transform.localScale = Vector3.one; info.name = towerController.name; UIAnchor anchor = info.GetComponent <UIAnchor>(); anchor.container = InfoPanel.gameObject; anchor.relativeOffset = new Vector2(PlayConfig.AnchorTowerGuideInfoStartX + count * PlayConfig.AnchorTowerGuideInfoDistance, PlayConfig.AnchorTowerGuideInfoStartY); #region TOWER TowerShopInfoController infoController = info.GetComponent <TowerShopInfoController>(); infoController.icon.mainTexture = Resources.Load <Texture>(PlayConfig.getTowerIcon(towerID)); infoController.level.text = "Level " + ((int)towerID.Level).ToString(); infoController.atk.parent.transform.GetComponentInChildren <UISprite> ().spriteName = "icon-atk"; infoController.atk.text = towerController.attribute.MinATK.ToString() + " - " + towerController.attribute.MaxATK.ToString(); infoController.spawnShoot.text = towerController.attribute.SpawnShoot.ToString(); infoController.timeBuild.text = towerController.attribute.TimeBuild.ToString(); //Bullet label string[] str = PlayConfig.getBulletType(towerController.attackType.ToString()); infoController.bulletAbility.text = str[0] + " TARGET"; infoController.bulletRegion.text = str[1]; //set icon fix size infoController.icon.keepAspectRatio = UIWidget.AspectRatioSource.Free; infoController.icon.SetDimensions(infoController.icon.mainTexture.width, infoController.icon.mainTexture.height); infoController.icon.keepAspectRatio = UIWidget.AspectRatioSource.BasedOnHeight; UIStretch uiStretch = infoController.icon.GetComponent <UIStretch>(); uiStretch.enabled = true; #endregion #region BULLET object[] bulletData = PlayConfig.getBulletShop(towerID); infoController.bulletIcon.mainTexture = Resources.Load <Texture>("Image/Bullet/Bullet Icon/" + bulletData[0].ToString()); infoController.bulletIcon.keepAspectRatio = UIWidget.AspectRatioSource.Free; infoController.bulletIcon.SetDimensions(infoController.bulletIcon.mainTexture.width, infoController.bulletIcon.mainTexture.height); infoController.bulletIcon.keepAspectRatio = UIWidget.AspectRatioSource.BasedOnHeight; UIStretch stretch = infoController.bulletIcon.GetComponent <UIStretch>(); stretch.relativeSize.y = (float)bulletData[1]; stretch.enabled = true; //Add effect infoController.bullet = towerController.bullet; #endregion count++; listTower.Add(info); //get Next Tower if (towerController.nextLevel != null) { towerID = towerController.nextLevel.GetComponent <TowerController>().ID; towerController = towerController.nextLevel; } else { maxLevel = count; currentLevel = 1; towerLevelSelected.transform.position = levels[currentLevel - 1].transform.position; break; } } break; } } towers = ObjectManager.Instance.TowersPassive; length = towers.Length; for (int i = 0; i < length; i++) { TowerPassiveController towerController = towers[i].GetComponent <TowerPassiveController>(); if (towerController.ID.Type == towerID.Type && towerController.ID.Level == towerID.Level) { while (true) { GameObject info = Instantiate(PlayManager.Instance.modelPlay.TowerGuideInfo) as GameObject; info.transform.parent = infoTower.transform; info.transform.localScale = Vector3.one; info.name = towerController.name; UIAnchor anchor = info.GetComponent <UIAnchor>(); anchor.container = InfoPanel.gameObject; anchor.relativeOffset = new Vector2(PlayConfig.AnchorTowerGuideInfoStartX + count * PlayConfig.AnchorTowerGuideInfoDistance, PlayConfig.AnchorTowerGuideInfoStartY); #region TOWER TowerShopInfoController infoController = info.GetComponent <TowerShopInfoController>(); infoController.icon.mainTexture = Resources.Load <Texture>(PlayConfig.getTowerIcon(towerID)); infoController.level.text = "Level " + ((int)towerID.Level).ToString(); infoController.atk.parent.transform.GetComponentInChildren <UISprite> ().spriteName = "icon-gold"; infoController.atk.text = towerController.passiveAttribute.Value.ToString(); infoController.spawnShoot.text = towerController.passiveAttribute.UpdateTime.ToString(); infoController.timeBuild.text = towerController.passiveAttribute.TimeBuild.ToString(); //Bullet label //string[] str = PlayConfig.getBulletType(towerController.attackType.ToString()); infoController.bulletAbility.text = towerController.passiveAttribute.Describe.ToString(); infoController.bulletRegion.text = towerController.passiveAttribute.Type.ToString();; //set icon fix size infoController.icon.keepAspectRatio = UIWidget.AspectRatioSource.Free; infoController.icon.SetDimensions(infoController.icon.mainTexture.width, infoController.icon.mainTexture.height); infoController.icon.keepAspectRatio = UIWidget.AspectRatioSource.BasedOnHeight; UIStretch uiStretch = infoController.icon.GetComponent <UIStretch>(); uiStretch.enabled = true; #endregion #region BULLET object[] bulletData = PlayConfig.getBulletShop(towerID); infoController.bulletIcon.mainTexture = Resources.Load <Texture>("Image/Bullet/Bullet Icon/" + bulletData[0].ToString()); infoController.bulletIcon.keepAspectRatio = UIWidget.AspectRatioSource.Free; infoController.bulletIcon.SetDimensions(infoController.bulletIcon.mainTexture.width, infoController.bulletIcon.mainTexture.height); infoController.bulletIcon.keepAspectRatio = UIWidget.AspectRatioSource.BasedOnHeight; UIStretch stretch = infoController.bulletIcon.GetComponent <UIStretch>(); stretch.relativeSize.y = (float)bulletData[1]; stretch.enabled = true; //Add effect infoController.bullet = towerController.bullet; #endregion count++; listTower.Add(info); //get Next Tower if (towerController.nextLevel != null) { towerID = towerController.nextLevel.GetComponent <TowerPassiveController>().ID; towerController = (TowerPassiveController)towerController.nextLevel; } else { maxLevel = count; currentLevel = 1; towerLevelSelected.transform.position = levels[currentLevel - 1].transform.position; break; } } break; } } } }
void OnClick() { if (type == ETowerType.NONE && towerAction.isActivity) { PlayManager playManager = PlayManager.Instance; if (playManager.objectUpgrade.Tower != towerController.gameObject) { playManager.resetUpgrade(); } type = ETowerType.CHOOSED; panelTween.PlayForward(); if (playManager.tempInit.panelDragonInfo != null) { playManager.tempInit.panelDragonInfo.GetComponent <TweenPosition>().PlayReverse(); } playManager.objectUpgrade.Tower = towerController.gameObject; playManager.resetBuilding(); // set range for tower playManager.setRangeTower(towerController.attribute.Range, this.gameObject); // get range of tower current playManager.towerInfoController.rangeCurrent = towerController.attribute.Range; if (towerController is TowerPassiveController) { TowerPassiveController towerPassiveController = (TowerPassiveController)towerController; TowerPassiveController nextLV = (TowerPassiveController)towerPassiveController.nextLevel; if (nextLV != null) { playManager.towerPassiveInfoController.setTowerInfo(towerPassiveController); playManager.towerPassiveInfoController.setNextTowerIcon(nextLV.ID); playManager.towerPassiveInfoController.setValueInfo(towerPassiveController.ID, towerPassiveController.passiveAttribute.Describe ); } else { playManager.towerPassiveInfoController.setTowerInfo(towerPassiveController); playManager.towerPassiveInfoController.setValueInfo(towerPassiveController.ID, towerPassiveController.passiveAttribute.Describe); } } else { TowerController nextLV = towerController.nextLevel; if (nextLV != null) { playManager.towerInfoController.setTowerInfo(towerController); playManager.towerInfoController.setNextTowerIcon(nextLV.ID); playManager.towerInfoController.setBulletInfo(towerController.ID, towerController.attackType.ToString(), towerController.bullet); // get range of tower next level playManager.towerInfoController.rangeUpgrade = nextLV.attribute.Range; } else { playManager.towerInfoController.setTowerInfo(towerController); playManager.towerInfoController.setBulletInfo(towerController.ID, towerController.attackType.ToString(), towerController.bullet); } } // show tutorial upgrade neu lan dau tien su dung if (PlayerInfo.Instance.tutorialInfo.tutorial_upgrade == 0 && WaveController.Instance.currentMap == 1 && SceneState.Instance.State == ESceneState.ADVENTURE) { PlayerInfo.Instance.tutorialInfo.tutorial_upgrade = 1; PlayerInfo.Instance.tutorialInfo.Save(); playManager.tutorial.SetActive(true); UIButtonTutorialPlay.Instance.startTutorialUpgrade(); } if (SceneState.Instance.State == ESceneState.ADVENTURE) { if (PlayTouchManager.Instance.skillTarget != null) { if (PlayTouchManager.Instance.skillTarget != this.gameObject) { PlayDragonInfoSkillController temp = PlayTouchManager.Instance.skillTarget.GetComponent <PlayDragonInfoSkillController>(); temp.selected.GetComponent <TweenScale>().PlayReverse(); temp.selected.GetComponent <TweenAlpha>().PlayReverse(); temp.typeSprite.GetComponent <TweenPosition>().PlayReverse(); temp.typeSprite.GetComponent <TweenAlpha>().PlayReverse(); temp.isTap = false; PlayTouchManager.Instance.skillTarget = null; PlayTouchManager.Instance.setCurrentOffenseType(ESkillOffense.AOE); } } } } }