public void CopperAtIndex(int index) { if (getBiomeAtIndex(index) == HIGH_BIOME) { if (vertices [index].getResource() != null && vertices [index].getResource().name.Contains("Copper")) { return; } ResourceController resourceCont = (GameObject.FindObjectOfType(typeof(ResourceController)) as ResourceController); if (resourceCont != null) { resourceCont.CopperMade(vertices [index]); } (GameObject.FindObjectOfType(typeof(MusicController)) as MusicController).StartPlacing(); GameObject copper = Resources.Load("Prefabs/CopperVein" + Random.Range(0, 1), typeof(GameObject)) as GameObject; copper = Instantiate(copper, transform.TransformPoint(vertices[index].getSphereVector()), Quaternion.identity) as GameObject; vertices [index].removeResource(); vertices [index].setResource(copper); } }
public void FireBuilt() { curTier++; GameObject g = GameObject.Find("TierNum"); if (g != null) { Text t = g.GetComponent <Text> (); if (t != null) { t.text = curTier.ToString(); } } g = GameObject.Find("TierName"); if (g != null) { g.GetComponent <ToggleEraText> ().ChangeEraText(curTier); } ResourceController cont = GetComponent <ResourceController>(); SphereTerrain terrain = FindObjectOfType <SphereTerrain> (); for (int i = 0; i < terrain.vertices.Length; i++) { Vertex v = terrain.vertices[i]; if (v.getBiome() == SphereTerrain.WATER_BIOME) { cont.WaterMade(v); } if (v.getBiome() == SphereTerrain.STONE_BIOME) { cont.StoneMade(v); } if (v.getBiome() == SphereTerrain.OIL_BIOME) { cont.OilMade(v); } if (v.getResource() != null) { if (v.getResource().name.Contains("Forest")) { cont.TreeMade(v); } if (v.getResource().name.Contains("Sand")) { cont.SandMade(v); } if (v.getResource().name.Contains("Wheat")) { cont.WheatMade(v); } if (v.getResource().name.Contains("Iron")) { cont.IronMade(v); } if (v.getResource().name.Contains("Copper")) { cont.CopperMade(v); } if (v.getResource().name.Contains("Coal")) { cont.CoalMade(v); } } } }
public void IncreaseTier() { if (CheckTier()) { ConstructEra(); curTier++; GameObject g = GameObject.Find("TierNum"); if (g != null) { Text t = g.GetComponent <Text> (); if (t != null) { t.text = curTier.ToString(); } } g = GameObject.Find("TierName"); if (g != null) { g.GetComponent <ToggleEraText> ().ChangeEraText(curTier); g.GetComponent <ToggleEraText> ().firstTimeInTier = true; } ResourceController cont = GetComponent <ResourceController>(); SphereTerrain terrain = FindObjectOfType <SphereTerrain> (); for (int i = 0; i < terrain.vertices.Length; i++) { Vertex v = terrain.vertices[i]; if (v.getBiome() == SphereTerrain.WATER_BIOME) { cont.WaterMade(v); } if (v.getBiome() == SphereTerrain.STONE_BIOME) { cont.StoneMade(v); } if (v.getBiome() == SphereTerrain.OIL_BIOME) { cont.OilMade(v); } if (v.getResource() != null) { if (v.getResource().name.Contains("Forest")) { cont.TreeMade(v); } if (v.getResource().name.Contains("Sand")) { cont.SandMade(v); } if (v.getResource().name.Contains("Wheat")) { cont.WheatMade(v); } if (v.getResource().name.Contains("Iron")) { cont.IronMade(v); } if (v.getResource().name.Contains("Copper")) { cont.CopperMade(v); } if (v.getResource().name.Contains("Coal")) { cont.CoalMade(v); } } } //TODO: check if we want all resources present in the spheremap tierIncreaseEvent.Invoke(); } }