void Update() { tile = tileUI.tile; switch (tile.biome) { case hexTile2.biomes.MOUNTAIN: this.gameObject.transform.Find("Biome").GetComponent<Image>().sprite= biomes[0]; break; case hexTile2.biomes.DESERT: this.gameObject.transform.Find("Biome").GetComponent<Image>().sprite = biomes[1]; break; case hexTile2.biomes.PLAINS: this.gameObject.transform.Find("Biome").GetComponent<Image>().sprite = biomes[2]; break; case hexTile2.biomes.VALLEY: this.gameObject.transform.Find("Biome").GetComponent<Image>().sprite = biomes[3]; break; case hexTile2.biomes.HILLS: this.gameObject.transform.Find("Biome").GetComponent<Image>().sprite = biomes[4]; break; case hexTile2.biomes.MARSHES: this.gameObject.transform.Find("Biome").GetComponent<Image>().sprite = biomes[5]; break; case hexTile2.biomes.FOREST: this.gameObject.transform.Find("Biome").GetComponent<Image>().sprite = biomes[6]; break; case hexTile2.biomes.TUNDRA: this.gameObject.transform.Find("Biome").GetComponent<Image>().sprite = biomes[7]; break; case hexTile2.biomes.OCEAN: this.gameObject.transform.Find("Biome").GetComponent<Image>().sprite = biomes[8]; break; } }
void Update() { tile = tileUI.tile; switch (tile.biome) { case hexTile2.biomes.MOUNTAIN: this.gameObject.transform.Find("Biome").GetComponent <Image>().sprite = biomes[0]; break; case hexTile2.biomes.DESERT: this.gameObject.transform.Find("Biome").GetComponent <Image>().sprite = biomes[1]; break; case hexTile2.biomes.PLAINS: this.gameObject.transform.Find("Biome").GetComponent <Image>().sprite = biomes[2]; break; case hexTile2.biomes.VALLEY: this.gameObject.transform.Find("Biome").GetComponent <Image>().sprite = biomes[3]; break; case hexTile2.biomes.HILLS: this.gameObject.transform.Find("Biome").GetComponent <Image>().sprite = biomes[4]; break; case hexTile2.biomes.MARSHES: this.gameObject.transform.Find("Biome").GetComponent <Image>().sprite = biomes[5]; break; case hexTile2.biomes.FOREST: this.gameObject.transform.Find("Biome").GetComponent <Image>().sprite = biomes[6]; break; case hexTile2.biomes.TUNDRA: this.gameObject.transform.Find("Biome").GetComponent <Image>().sprite = biomes[7]; break; case hexTile2.biomes.OCEAN: this.gameObject.transform.Find("Biome").GetComponent <Image>().sprite = biomes[8]; break; } }
bool onOtherContinent(GameObject obj, hexTile2 origional) { for (int i = 0; i < landMasses.Count; i++) { if (landMasses[i].lands.Contains(origional)) { continue; } else { for (int j = 0; j < obj.GetComponent<hexTile2>().counter; j++) { if (landMasses[i].lands.Contains(obj.GetComponent<hexTile2>().neighbors[j].GetComponent<hexTile2>())) { return true; } } } } return false; }
void genBiome(GameObject start, hexTile2.biomes biome) { hexTile2 temp = start.GetComponent<hexTile2>(); if (isRealistic) { if (!checkBiomeLocation(temp, biome)) { return; } if (biome == hexTile2.biomes.DESERT || biome == hexTile2.biomes.TUNDRA || biome == hexTile2.biomes.FOREST) { acceptableX.Remove(temp.widthInArray); } } temp.setTerrain(biome); biomeNums[(int)biome - 1]++; temp.isChecked = true; biomeSizeHolder.Add(temp); List<GameObject> acceptableNeighbors = new List<GameObject>(); for(int i = 0; i < temp.counter; i++) { if(!temp.neighbors[i].GetComponent<hexTile2>().isChecked && !temp.neighbors[i].GetComponent<hexTile2>().isOcean) { acceptableNeighbors.Add(temp.neighbors[i]); } } int numTurning = UnityEngine.Random.Range(0, acceptableNeighbors.Count); if (numTurning != 0) { for (int i = 0; i < numTurning; i++) { int neighbor = UnityEngine.Random.Range(0, acceptableNeighbors.Count - 1); if (biomeNums[(int)biome-1] == tileBiomeNum || biomeSizeHolder.Count >= 10) { return; } genBiome(acceptableNeighbors[neighbor], biome); } } }
bool checkBiomeLocation(hexTile2 tile, hexTile2.biomes biome) { int heightChunk = _height / 5; int heightInArray = tile.heightInArray; switch (biome) { case hexTile2.biomes.TUNDRA: if (heightInArray >= (_height - heightChunk - biomeBleedHeight) || heightInArray <= heightChunk + biomeBleedHeight) { return true; } break; case hexTile2.biomes.FOREST: if ((heightInArray <= (_height - heightChunk + biomeBleedHeight) && heightInArray >= (_height - heightChunk * 2) - biomeBleedHeight) || (heightInArray >= heightChunk - biomeBleedHeight && heightInArray <= heightChunk * 2 + biomeBleedHeight)) { return true; } break; case hexTile2.biomes.DESERT: if(heightInArray <= (_height - heightChunk*2 + biomeBleedHeight) && heightInArray >= (heightChunk*2) - biomeBleedHeight) { return true; } break; default: return true; } return false; }
void addToContinent(GameObject obj, hexTile2 origional) { for (int i = 0; i < landMasses.Count; i++) { if(landMasses[i].lands.Contains(origional)) { landMasses[i].lands.Add(obj.GetComponent<hexTile2>()); break; } } }