public void BuildCityHall(NodeTouch node) { GameObject structure = Instantiate(cityHall, node.GetBuildPosition(), cityHall.transform.rotation); node.buildingThere = structure; Debug.Log("City hall did it"); node.gameObject.GetComponent <MeshRenderer>().enabled = false; if (GameControl.control.tutorial == true) { player.IncreaseMoney(startingMoney); } node.nodeInfo.idBuilding = (int)idBuildings.cityhall; structureToBuild = null; haveCityHall = true; DeselectNode(); if (GameControl.control.tutorial && SceneManager.GetActiveScene().buildIndex == 1) { GameObject.Find("TutorialArrows").GetComponent <Tutorial>().FirtsIndicator(); } /*GameObject tut = GameObject.Find("TutorialArrows"); * if(tut != null) * { * tut.GetComponent<Tutorial>().FirtsIndicator(); * }*/ }
public void RebuildStructures(NodeTouch node) { if (structureToBuild == null) { return; } GameObject structure = (GameObject)Instantiate(structureToBuild.prefab, node.GetBuildPosition(), structureToBuild.prefab.transform.rotation); node.nodeInfo.idBuilding = (int)structureToBuild.id; node.structureThere = structureToBuild; Debug.Log("CONSTRUIDO"); //SoundManager.soundManager.PlayConstruction(); //Hide the node node.gameObject.GetComponent <MeshRenderer>().enabled = false; if (!structureToBuild.isWater) { node.buildingThere = structure; } else { node.haveWater = true; } structureToBuild.nodeAsociate = node; structureToBuild = null; //GameObject aux = Instantiate(buildParticlePrefab, node.transform.position, Quaternion.identity); //buildParticle = aux.GetComponentInChildren<ParticleSystem>(); //buildParticle.Play(); }
public void BuildStructure(StructureBlueprint structureBlueprint, Node _buildingNode) { GameObject builtStructure = Instantiate(structureBlueprint.prefab, _buildingNode.GetBuildPosition().position, Quaternion.identity); builtStructure.GetComponent <Structure>().LinkNode(_buildingNode); UIManager_battle.SelectedNode.gameObject.layer = LayerMask.NameToLayer("Obstacles"); }
public void SelectThisBuilding(int id) { if (id == (int)idBuildings.coalfactory) { structureToBuild = inventoryBuilding.coalFactoryStructure; } else if (id == (int)idBuildings.windmill) { structureToBuild = inventoryBuilding.windmillStructure; } else if (id == (int)idBuildings.gasextractor) { structureToBuild = inventoryBuilding.gasExtractorStructure; } else if (id == (int)idBuildings.solarpanel) { structureToBuild = inventoryBuilding.solarPanelStructure; } else if (id == (int)idBuildings.river) { structureToBuild = inventoryBuilding.riverPart; } else if (id == (int)idBuildings.statueOfLiberty) { structureToBuild = inventoryBuilding.statueOfLiberty; } else if (id == (int)idBuildings.shop) { structureToBuild = inventoryBuilding.shop; } else if (id == (int)idBuildings.park) { structureToBuild = inventoryBuilding.park; } else if (id == (int)idBuildings.eiffle) { structureToBuild = inventoryBuilding.eiffleTower; } else if (id == (int)idBuildings.wheel) { structureToBuild = inventoryBuilding.ferrisWheel; } else if (id == (int)idBuildings.pisaTower) { structureToBuild = inventoryBuilding.pisaTower; } else if (id == (int)idBuildings.diner) { structureToBuild = inventoryBuilding.diner; } else if (id == (int)idBuildings.fireStation) { structureToBuild = inventoryBuilding.fireStation; } else if (id == (int)idBuildings.policeStation) { structureToBuild = inventoryBuilding.policeStation; } }
public void SelectStructureToBuild(StructureBlueprint structure) { structureToBuild = structure; DeselectNode(); //Deselecionamos la zona }
public void SelectStructureToBuild(StructureBlueprint structure) { structureToBuild = structure; DeselectNode(); createEnvironment.ShowRenderNodes(); // Grid.SetActive(true); }
public void Setup(StructureBlueprint currentGameUnit, StructureShop currentStructureShop) { structure = currentGameUnit; nameLabel.text = structure.name; iconImage.sprite = structure.icon; priceText.text = structure.buildCost.ToString(); structureShop = currentStructureShop; }
public void BuyStructure(StructureBlueprint _structureBlueprint) { if (HasMoneys(_structureBlueprint.buildCost)) { GameMaster.Money -= _structureBlueprint.buildCost; structureBuilder.BuildStructure(_structureBlueprint, UIManager_battle.SelectedNode); } }
public void SelectNode(Building node) { if (selectedNode == node) { DeselectNode(); return; } selectedNode = node; structureToBuild = null; nodeUI.SetTarget(node); }
public void BuildGoal(StructureBlueprint structure) { if (goalType == GoalType.BuildWindmill && structure.id == idBuildings.windmill) { currentElements++; } else if (goalType == GoalType.BuildSolarpanel && structure.id == idBuildings.solarpanel) { currentElements++; } else { Debug.Log("No solar or wind energy goal"); } }
public void ShowInfoWithOutBuyButton(StructureBlueprint structure) { // buildManager.HideConstructionPanel(); icon.sprite = structure.icon; titleText.text = structure.title; descriptionText.text = structure.description; moneyText.text = structure.moneyPerTap / 1000 + "K"; happinessText.text = "+" + structure.amountOfHappiness; energyText.text = "+" + structure.amountOfEnergy; pollutionText.text = "+" + structure.amountOfPollution; costText.text = structure.cost.ToString(); infoPanel.SetActive(true); infoPanel.transform.Find("BuyButton").gameObject.SetActive(false); cameraActivated = false; }
private void DoConstructionSitePreview() { Model model = GetDialogCustomData <Model>(); if (model.IsPreviewing) { return; } Data.Entities.ConstructionSite entity = _structure.GetConstructionSiteByID(model.ConstructionSiteID); StructureBlueprint blueprint = entity.StructureBlueprint; NWPlaceable preview = NWPlaceable.Wrap(_.CreateObject(OBJECT_TYPE_PLACEABLE, blueprint.Resref, GetDialogTarget().Location)); preview.IsUseable = false; preview.IsPlot = true; preview.Destroy(6.0f); preview.DelayCommand(() => { model.IsPreviewing = false; }, 6.0f); }
private void DoBlueprintPreview(int blueprintID) { Model model = GetDialogCustomData <Model>(); if (model.IsPreviewing) { return; } model.IsPreviewing = true; StructureBlueprint entity = _structure.GetStructureBlueprintByID(blueprintID); NWPlaceable preview = NWPlaceable.Wrap(_.CreateObject(OBJECT_TYPE_PLACEABLE, entity.Resref, GetDialogTarget().Location)); preview.IsUseable = false; preview.IsPlot = true; preview.Destroy(6.0f); preview.DelayCommand(() => { model.IsPreviewing = false; }, 6.0f); }
private void LoadChangeLayoutResponses() { ClearPageResponses("ChangeLayoutPage"); Model model = GetDialogCustomData <Model>(); StructureBlueprint blueprint = _structure.GetConstructionSiteByID(model.ConstructionSiteID).StructureBlueprint; if (!blueprint.IsBuilding || blueprint.BuildingCategory == null) { return; } List <BuildingInterior> options = _structure.GetBuildingInteriorsByCategoryID(blueprint.BuildingCategory.BuildingCategoryID); foreach (BuildingInterior option in options) { AddResponseToPage("ChangeLayoutPage", option.Name, true, new Tuple <string, dynamic>(string.Empty, option)); } AddResponseToPage("ChangeLayoutPage", "Back"); }
public void ShowInfo(StructureBlueprint structure) { buildManager.HideConstructionPanel(); icon.sprite = structure.icon; titleText.text = structure.title; descriptionText.text = structure.description; moneyText.text = structure.moneyPerTap / 1000 + "K"; happinessText.text = "+" + structure.amountOfHappiness; energyText.text = "+" + structure.amountOfEnergy; pollutionText.text = "+" + structure.amountOfPollution; costText.text = structure.cost.ToString(); //windmillStructure.informationPanel.SetActive(true); Debug.Log(" ASFOIJASDJGDSAKBJHODSAJGJODSJSDAOJDSOJFDSAJOSOJO "); infoPanel.SetActive(true); infoPanel.transform.Find("BuyButton").gameObject.SetActive(true); structureBuy = structure; }
public void HideInfoPanel() { infoPanel.SetActive(false); structureBuy = null; cameraActivated = true; }
public void UpdatePriceUpdateBuilding(StructureBlueprint structure) { textPriceUpdate.text = structure.costUpgrades[structure.levelBuilding - 1].ToString(); }
public void UpdateLevel(StructureBlueprint structure) { textLevel.text = "Level: " + structure.levelBuilding; UpdatePriceUpdateBuilding(structure); }
public void SelectNode(NodeTouch node) { if (node.tag == "CityPlace" && haveCityHall == false) { BuildCityHall(node); return; } if (haveCityHall) { if (selectedNode == node) { //node.gameObject.GetComponent<MeshRenderer>().enabled = false; DeselectNode(); return; } if (node.isUnlock == false) { DeselectNode(); return; } /* * if (structureToBuild == null && node.buildingThere == null) * { * buildPanel.SetActive(true); * HideInfoPanel(); * selectedNode = node; * return; * } * */ if (structureToBuild != null && node.buildingThere == null) { BuildStructureOn(node); //buildPanel.SetActive(false); DeselectNode(); structureToBuild = null; return; } if (node.buildingThere == null) { DeselectNode(); return; } //If in the node are something if (node.buildingThere != null && node.buildingThere.tag != "House" && node.buildingThere.tag != "CityHall") { selectedNode = node; //infoPanel.SetActive(true); if (destroyActivate) { //destroyPanelSelection.SetActive(true); DestroyThisBuilding(); HideEverything(); return; } //HideConstructionPanel(); HideEverything(); ShowInfoPanelBuildings(); return; } //if(node.buildingThere != null && node.buildingThere.tag == "Monuments" && destroyActivate) //{ // Debug.Log("Demolish monument"); // DestroyThisBuilding(); // HideEverything(); // return; //} } }
public void BuildStructureOn(NodeTouch node) { if (structureToBuild == null) { return; } if (!HasEnoughMoney()) { Debug.Log("Not enough money!"); player.NotEnoughMoneyPlay(); return; } if (node.haveWater && !structureToBuild.needWater) { Debug.Log("The structure can't build in water"); return; } player.DecreaseMoney(structureToBuild.cost); player.IncreaseHappiness(structureToBuild.amountOfHappiness); player.IncreasePollution(structureToBuild.amountOfPollution); player.IncreaseEnergy(structureToBuild.amountOfEnergy); if (player.activeQuest.Count != 0) { player.activeQuest[0].goal.BuildGoal(structureToBuild); } GameObject structure = (GameObject)Instantiate(structureToBuild.prefab, node.GetBuildPosition(), structureToBuild.prefab.transform.rotation); node.nodeInfo.idBuilding = (int)structureToBuild.id; node.structureThere = structureToBuild; Debug.Log("CONSTRUIDO"); SoundManager.soundManager.PlayConstruction(); //Hide the node node.gameObject.GetComponent <MeshRenderer>().enabled = false; if (!structureToBuild.isWater) { node.buildingThere = structure; } else { node.haveWater = true; } structureToBuild.nodeAsociate = node; if (structureToBuild.id == idBuildings.diner) { if (SceneManager.GetActiveScene().name == "CoalIsland") { inventoryBuilding.coalFactoryStructure.timeMoney *= 0.75f; } } structureToBuild = null; GameObject aux = Instantiate(buildParticlePrefab, node.transform.position, Quaternion.identity); buildParticle = aux.GetComponentInChildren <ParticleSystem>(); buildParticle.Play(); }
public void UpgradeStructure(StructureBlueprint _structureBlueprint, Node _buildingNode) { Destroy(_buildingNode.structureOnThisNode.gameObject); BuildStructure(_structureBlueprint, _buildingNode); }