void OnMouseDownSimulation() { Tuto_MinorIsland island = GameObject.Find(this.transform.parent.parent.parent.name).GetComponent <Tuto_MinorIsland>(); island.buildingClicked = this.name.Split('_')[1]; if (island.buildingInfoPresent == false) //if any buildingInfo is open (not more than one at the same time) { Canvas buildingInfoPrefab = Resources.Load <Canvas>("Prefab/Tuto/BuildingInfoWindowCanvasTuto"); Canvas buildingInfo = Instantiate(buildingInfoPrefab); buildingInfo.name = "BuildingInfo_" + island.nameTuto_MinorIsland + "_" + this.name; buildingInfo.transform.SetParent(this.transform.parent.parent.parent); //parent : minorIsland Vector3 pos = GameObject.Find("Virtual_" + island.nameTuto_MinorIsland).transform.position; pos.z = -2; buildingInfo.GetComponentInChildren <Image>().transform.position = pos; //rotation of image according to the place of the island char id = island.nameTuto_MinorIsland[island.nameTuto_MinorIsland.Length - 1]; if (id == '1' || id == '2') { buildingInfo.GetComponentInChildren <Image>().transform.Rotate(Vector3.forward * 180); } island.buildingInfoPresent = true; } Destroy(GameObject.Find("WheelCanvas_" + island.nameTuto_MinorIsland)); }
void OnMouseDownSimulation() { string name = this.gameObject.transform.parent.name; this.namePopupCanvas = name; string[] nameSplitted = name.Split('_'); this.island = GameObject.Find(nameSplitted[1] + "_" + nameSplitted[2] + "_" + nameSplitted[3]).GetComponent<Tuto_MinorIsland>(); this.touched = true; this.gameObject.GetComponent<BoxCollider>().enabled = false; Destroy(GameObject.Find(namePopupCanvas)); }
void OnMouseDownSimulation() { string name = this.gameObject.transform.parent.name; this.namePopupCanvas = name; string[] nameSplitted = name.Split('_'); this.island = GameObject.Find(nameSplitted[1] + "_" + nameSplitted[2] + "_" + nameSplitted[3]).GetComponent <Tuto_MinorIsland>(); this.touched = true; this.gameObject.GetComponent <BoxCollider>().enabled = false; Destroy(GameObject.Find(namePopupCanvas)); }
void OnMouseDownSimulation() { island = this.transform.parent.parent.parent.GetComponent <Tuto_MinorIsland>(); buildingClicked = island.buildingClicked; if (this.name == "Build") { Destroy(GameObject.Find("WheelCanvas_" + this.transform.parent.parent.parent.name)); island.wheelPresent = false; island.createTuto_ChallengeBuild(buildingClicked); island.harborBuilt = true; } island.buildingInfoPresent = false; Destroy(GameObject.Find(this.transform.parent.parent.name)); }
void OnMouseDownSimulation() { island = this.transform.parent.parent.parent.GetComponent<Tuto_MinorIsland>(); buildingClicked = island.buildingClicked; if (this.name == "Build") { Destroy(GameObject.Find("WheelCanvas_" + this.transform.parent.parent.parent.name)); island.wheelPresent = false; island.createTuto_ChallengeBuild(buildingClicked); island.harborBuilt = true; } island.buildingInfoPresent = false; Destroy(GameObject.Find(this.transform.parent.parent.name)); }
void OnMouseDownSimulation() { island = GameObject.Find(this.transform.parent.parent.parent.name).GetComponent <Tuto_MinorIsland>(); Debug.Log(island.nameBuildingTouchCanvas); building = island.building; if (this.name == "Upgrade") { island.buildingInfoPresent = false; island.createTuto_ChallengeUpgrade(building); } Destroy(GameObject.Find(this.transform.parent.parent.name)); island.nameBuildingTouchCanvas = string.Empty; }
public void init(Tuto_MinorIsland island) { this.level = 0; this.buildState = 0; this.tuto_minorIsland = island; this.name = this.tuto_minorIsland.nameTuto_MinorIsland + "_Harbor"; this.texturePath = "Building/Icons/wheelIcon_Harbor"; this.constructionTime = 5; GetComponent <Transform>().localScale = new Vector3(9f, 9f, 1f); StartCoroutine("build"); }
void OnMouseDownSimulation() { island = GameObject.Find(this.transform.parent.parent.parent.name).GetComponent<Tuto_MinorIsland>(); Debug.Log(island.nameBuildingTouchCanvas); building = island.building; if (this.name == "Upgrade") { island.buildingInfoPresent = false; island.createTuto_ChallengeUpgrade(building); } Destroy(GameObject.Find(this.transform.parent.parent.name)); island.nameBuildingTouchCanvas = string.Empty; }
void OnMouseDownSimulation() { Vector3 pos; island = GameObject.Find(this.transform.parent.parent.parent.name).GetComponent<Tuto_MinorIsland>(); island.building = GameObject.Find(island.nameTuto_MinorIsland + "_Harbor").GetComponent<Tuto_Building>(); building = island.building; switch (this.name) { case "Upgrade": if (island.harborMoved) { Canvas upgradeTuto_BuildingWindowCanvasPrefab = Resources.Load<Canvas>("Prefab/Tuto/UpgradeBuildingWindowCanvasTuto"); Canvas upgradeTuto_BuildingWindowCanvas = Instantiate(upgradeTuto_BuildingWindowCanvasPrefab); upgradeTuto_BuildingWindowCanvas.name = "UpgradeBuildingWindowCanvas_" + building.name + "_" + island.nameTuto_MinorIsland; upgradeTuto_BuildingWindowCanvas.transform.SetParent(this.transform.parent.parent.parent); //parent : sous_ile pos = GameObject.Find("Virtual_" + island.nameTuto_MinorIsland).transform.position; pos.z = -2; upgradeTuto_BuildingWindowCanvas.GetComponentInChildren<Image>().transform.position = pos; //rotation of image according to the place of the island char id = island.nameTuto_MinorIsland[island.nameTuto_MinorIsland.Length - 1]; if (id == '1' || id == '2') upgradeTuto_BuildingWindowCanvas.GetComponentInChildren<Image>().transform.Rotate(Vector3.forward * 180); //modification of the content of the different Text Children of the Canvas foreach (Text textInCanvas in upgradeTuto_BuildingWindowCanvas.GetComponent<Canvas>().GetComponentsInChildren<Text>()) { switch (textInCanvas.name) { case "Name": textInCanvas.text = "Amélioration 1"; break; case "CostValue1": textInCanvas.text = "0"; break; case "CostValue2": textInCanvas.text = "0"; break; } } //modification of the background of the different Image Children of the Canvas foreach (Image imageInCanvas in upgradeTuto_BuildingWindowCanvas.GetComponent<Canvas>().GetComponentsInChildren<Image>()) { switch (imageInCanvas.name) { case "CostImage1": imageInCanvas.sprite = null; break; case "CostImage2": imageInCanvas.sprite = null; break; //mêmes images case "ProductionImage": imageInCanvas.sprite = Resources.Load<Sprite>("infoBatiments/ResourcesIcons/FoodIcon"); break; case "ProductionImage2": imageInCanvas.sprite = Resources.Load<Sprite>("infoBatiments/ResourcesIcons/FoodIcon"); break; } } Destroy(GameObject.Find(this.transform.parent.parent.name)); } else { island.displayPopup("Commencez par déplacer le port.", 5); } break; case "Remove": if (island.exchangeResourceOpened) { StartCoroutine(building.tuto_minorIsland.tuto_buildingManager.destroyBuilding()); Destroy(GameObject.Find("touchBuilding_" + this.island.nameTuto_MinorIsland + "_Harbor")); } else { if (island.harborMoved) island.displayPopup("Maintenant, améliorez le port.", 5); else island.displayPopup("Commencez par déplacer le port.", 5); } break; case "Move": if (!island.harborMoved) { island.displayPopup("Appuyez sur l'endroit où placer le bâtiment", 3); island.moveBuilding = true; Destroy(GameObject.Find(this.transform.parent.parent.name)); } else { if (island.harborUpgraded) island.displayPopup("Affichez ensuite la fenêtre d'échange de ressources (appui long sur la table).", 5); else island.displayPopup("Maintenant, améliorez le port.", 5); } break; } }
// Use this for initialization void Start() { island = GameObject.Find(this.transform.parent.parent.parent.name).GetComponent <Tuto_MinorIsland>(); }
// Use this for initialization void Start() { island = GameObject.Find(this.transform.parent.parent.parent.name).GetComponent<Tuto_MinorIsland>(); }
public void init(Tuto_MinorIsland island) { this.tuto_minorIsland = island; }
void OnMouseDownSimulation() { Vector3 pos; island = GameObject.Find(this.transform.parent.parent.parent.name).GetComponent <Tuto_MinorIsland>(); island.building = GameObject.Find(island.nameTuto_MinorIsland + "_Harbor").GetComponent <Tuto_Building>(); building = island.building; switch (this.name) { case "Upgrade": if (island.harborMoved) { Canvas upgradeTuto_BuildingWindowCanvasPrefab = Resources.Load <Canvas>("Prefab/Tuto/UpgradeBuildingWindowCanvasTuto"); Canvas upgradeTuto_BuildingWindowCanvas = Instantiate(upgradeTuto_BuildingWindowCanvasPrefab); upgradeTuto_BuildingWindowCanvas.name = "UpgradeBuildingWindowCanvas_" + building.name + "_" + island.nameTuto_MinorIsland; upgradeTuto_BuildingWindowCanvas.transform.SetParent(this.transform.parent.parent.parent); //parent : sous_ile pos = GameObject.Find("Virtual_" + island.nameTuto_MinorIsland).transform.position; pos.z = -2; upgradeTuto_BuildingWindowCanvas.GetComponentInChildren <Image>().transform.position = pos; //rotation of image according to the place of the island char id = island.nameTuto_MinorIsland[island.nameTuto_MinorIsland.Length - 1]; if (id == '1' || id == '2') { upgradeTuto_BuildingWindowCanvas.GetComponentInChildren <Image>().transform.Rotate(Vector3.forward * 180); } //modification of the content of the different Text Children of the Canvas foreach (Text textInCanvas in upgradeTuto_BuildingWindowCanvas.GetComponent <Canvas>().GetComponentsInChildren <Text>()) { switch (textInCanvas.name) { case "Name": textInCanvas.text = "Amélioration 1"; break; case "CostValue1": textInCanvas.text = "0"; break; case "CostValue2": textInCanvas.text = "0"; break; } } //modification of the background of the different Image Children of the Canvas foreach (Image imageInCanvas in upgradeTuto_BuildingWindowCanvas.GetComponent <Canvas>().GetComponentsInChildren <Image>()) { switch (imageInCanvas.name) { case "CostImage1": imageInCanvas.sprite = null; break; case "CostImage2": imageInCanvas.sprite = null; break; //mêmes images case "ProductionImage": imageInCanvas.sprite = Resources.Load <Sprite>("infoBatiments/ResourcesIcons/FoodIcon"); break; case "ProductionImage2": imageInCanvas.sprite = Resources.Load <Sprite>("infoBatiments/ResourcesIcons/FoodIcon"); break; } } Destroy(GameObject.Find(this.transform.parent.parent.name)); } else { island.displayPopup("Commencez par déplacer le port.", 5); } break; case "Remove": if (island.exchangeResourceOpened) { StartCoroutine(building.tuto_minorIsland.tuto_buildingManager.destroyBuilding()); Destroy(GameObject.Find("touchBuilding_" + this.island.nameTuto_MinorIsland + "_Harbor")); } else { if (island.harborMoved) { island.displayPopup("Maintenant, améliorez le port.", 5); } else { island.displayPopup("Commencez par déplacer le port.", 5); } } break; case "Move": if (!island.harborMoved) { island.displayPopup("Appuyez sur l'endroit où placer le bâtiment", 3); island.moveBuilding = true; Destroy(GameObject.Find(this.transform.parent.parent.name)); } else { if (island.harborUpgraded) { island.displayPopup("Affichez ensuite la fenêtre d'échange de ressources (appui long sur la table).", 5); } else { island.displayPopup("Maintenant, améliorez le port.", 5); } } break; } }
public void init(Tuto_MinorIsland island) { this.level = 0; this.buildState = 0; this.tuto_minorIsland = island; this.name = this.tuto_minorIsland.nameTuto_MinorIsland + "_Harbor"; this.texturePath = "Building/Icons/wheelIcon_Harbor"; this.constructionTime = 5; GetComponent<Transform>().localScale = new Vector3(9f, 9f, 1f); StartCoroutine("build"); }