/// <summary> /// Returns <seealso cref="GameObject"/> that fits to given <seealso cref="ElementType"/> and that appears in given <seealso cref="Biomes"/>. /// </summary> /// <returns></returns> public GameObject GetMapElement(ElementType elementType, Biomes biome) { MapElementsSet set = null; GameObject element = null; foreach (MapElementsSet s in mapElementsSets) { if (s.biome == biome) { set = s; break; } } switch (elementType) { case ElementType.Ground: element = set.groundElement; break; case ElementType.Player: case ElementType.PlayerOnTarget: element = set.playerElement; break; case ElementType.Air: element = null; break; case ElementType.Box: case ElementType.DoneTarget: element = set.boxElement; break; case ElementType.Target: element = set.targetElement; break; } return(element); }
public void UserLoadLevel(string levelName) { string folder = Application.persistentDataPath + "/UserLevels"; string levelFile = levelName + ".json"; string path = Path.Combine(folder, levelFile); if (File.Exists(path)) { string json = File.ReadAllText(path); userData = JsonUtility.FromJson <UserEditorData>(json); ExtractUserLevel(userData); } currentOpenLevelName = userData.levelName; currentDifficltySetting = userData.creatorDifficulty; currentBiome = userData.biome; userData.nodesToSave.Clear(); activeNodes.Clear(); }
/// <summary> /// Sets camera background color fits to given <seealso cref="Biomes"/> /// </summary> public void SetBackgroundColor(Biomes biome) { switch (biome) { case Biomes.Grass: targetBackgroundColor = grassBiomeColor; break; case Biomes.Desert: targetBackgroundColor = desertBiomeColor; break; case Biomes.Winter: targetBackgroundColor = winterBiomeColor; break; case Biomes.Rock: targetBackgroundColor = rockBiomeColor; break; } }
// public void GenerateMap() { float[,] noise = GenerateNoiseMap(voronoi.mapWidth, voronoi.mapHeight, seed, noiseScale, octaves, persistance, lacunarity, offset); for (int i = 0; i < cells.Count; i++) { MapCell cell = cells[i]; int x = (int)cell.Position.x; int y = (int)cell.Position.y; float height = noise[x, y]; if (height < waterThreshold) { cell.SetBiome(Biomes.GetBiome("Ocean")); } else { cell.SetBiome(Biomes.GetBiome("Grasslands")); } } }
/// <summary> /// Creates new map which contains given elements. /// </summary> /// <param name="map">Elements</param> /// <param name="biomeType">Type of biome</param> /// <param name="difficulty">Level of difficulty</param> public Map(string name, ElementType[,] map, Biomes biomeType, Difficulty difficulty) { mapSize = new Vector2Int(map.GetLength(1), map.GetLength(0)); if (!IsOnePlayer(ref map)) { Debug.LogError("Map has to contain only one player element!"); return; } if (!ValidateBoxes(ref map)) { Debug.LogError("Count of boxes has to equal count of targets and must at least one!"); return; } this.name = name; this.difficulty = difficulty; this.biomeType = biomeType; mapDefinition = (ElementType[, ])map.Clone(); }
public string GetLevelFolder(Biomes biome) { string levelFolder = ""; switch (biome) { case Biomes.Plains: levelFolder = "01_Plains"; break; case Biomes.Mountains: levelFolder = "02_Mountains"; break; case Biomes.Underwater: levelFolder = "03_Underwater"; break; case Biomes.Ruins: levelFolder = "04_Ruins"; break; case Biomes.Statues: levelFolder = "05_Statues"; break; case Biomes.Temple: levelFolder = "06_Temple"; break; case Biomes.Chaos: levelFolder = "07_Chaos"; break; default: break; } return(levelFolder); }
public void CreateChunk() { //TODO: cambio de bioma definir como se da. if (Time.timeSinceLevelLoad > 5 && currentBiome == Biomes.city) { currentBiome = Biomes.village; Instantiate(villageChunks[0], lastChunkPosition, Quaternion.identity); //Update chunk positions int chunkSize = villageChunks[0].GetComponent <ChunkController>().chunkSize; lastChunkPosition += transform.forward * 10 * chunkSize - (transform.forward * 5); } //CITY //TODO: Refactor this, create dictionary [biome,randomInt] if (currentBiome == Biomes.city) { //Create random chunk; int randomChunk = Random.Range(0, cityChunks.Length); Instantiate(cityChunks[randomChunk], lastChunkPosition, Quaternion.identity); //Update chunnk positions int chunkSize = cityChunks[randomChunk].GetComponent <ChunkController>().chunkSize; lastChunkPosition += transform.forward * 10 * chunkSize - (transform.forward * 5); } //VILLAGE if (currentBiome == Biomes.village) { //Create random chunk; int randomChunk = Random.Range(1, villageChunks.Length); Instantiate(villageChunks[randomChunk], lastChunkPosition, Quaternion.identity); //Update chunnk positions int chunkSize = villageChunks[randomChunk].GetComponent <ChunkController>().chunkSize; lastChunkPosition += (transform.forward * 10 * chunkSize) - (transform.forward * 5); } }
/// <summary> /// Creates the BiomeMap based on the provided texture /// </summary> /// <param name="biomeTex">Biome Texture</param> /// <returns>true if successful</returns> public bool CreateBiomeMap(Texture2D biomeTex) { Color[] colorToEnumMapping = { new Color32(185, 122, 87, 1), // grassLand new Color32(34, 177, 76, 1), // forest new Color32(181, 230, 29, 1), // bushLand new Color32(255, 242, 0, 1) // fallow }; if (biomeTex == null) { return(false); } Biomes[,] outArr = new Biomes[biomeTex.width, biomeTex.height]; Color[] pixels = biomeTex.GetPixels(0, 0, biomeTex.width, biomeTex.height); for (int i = 0; i < pixels.Length; i++) { int x = i % biomeTex.width; int y = i / biomeTex.width; outArr[x, y] = Biomes.Unknown; for (int j = 0; j < colorToEnumMapping.Length; j++) { if (colorToEnumMapping[j].r == pixels[i].r && colorToEnumMapping[j].g == pixels[i].g && colorToEnumMapping[j].b == pixels[i].b) { outArr[x, y] = (Biomes)j + 1; } } } BiomeMap = outArr; return(true); }
/// <summary> /// Returns a block to build the roads with depending on the biome /// the road is on. /// </summary> /// <param name="biome"></param> /// <returns></returns> public static Material GetBiomeRoadBlock(Biomes biome) { switch (biome) { // Desert case Biomes.Desert: case Biomes.DesertHills: case Biomes.DesertM: case Biomes.Beach: return(AlphaMaterials.Cobblestone_4_0); case Biomes.Jungle: case Biomes.JungleEdge: case Biomes.JungleEdgeM: case Biomes.JungleHills: case Biomes.JungleM: return(AlphaMaterials.MossyStoneBricks_98_1); // Messa case Biomes.Mesa_Bryce: case Biomes.MesaPlateauFM: case Biomes.MesaPlateauM: case Biomes.Messa: case Biomes.MessaPlateau: case Biomes.MessaPlateauF: return(AlphaMaterials.Bricks_45_0); case Biomes.Savanna: case Biomes.SavannaM: case Biomes.SavannaPlateau: case Biomes.SavannaPlateauM: return(AlphaMaterials.Path_208_0); default: return(AlphaMaterials.Path_208_0); } }
public void UserLoadLevel(string levelName) { Debug.Log("User is Loading a Level !"); string folder = Application.persistentDataPath + "/UserLevels"; string levelFile = levelName + ".json"; string path = Path.Combine(folder, levelFile); if (File.Exists(path)) { string json = File.ReadAllText(path); levelData = JsonUtility.FromJson <LevelEditorData>(json); ExtractAndRebuildLevel(levelData); } currentOpenLevelName = levelData.levelName; currentKubicode = levelData.Kubicode; currentBiome = levelData.biome; levelData.nodesToSave.Clear(); activeNodes.Clear(); }
public FlowerForestDecorator(Biomes biome) : base(biome) { }
public Biome(Biomes type, Drawable representation) { Type = type; Representation = representation; }
public void SetBiome(Vector position, Biomes biome) => SetBiome(position.X, position.Y, position.Z, biome);
public FrozenRiverDecorator(Biomes biome, Chunk chunk, Vector surfacePos, BaseBiomeNoise noise) : base(biome, chunk, surfacePos, noise) { }
public void SwitchBiome(BiomeClass.Biomes newBiome) { currentBiome = newBiome; switch (newBiome) { case Biomes.Park: grassToGrass = 100f; grassToWater = 5f; grassToRoad = 0f; grassToWalk = 2f; waterToWater = 10f; waterToRoad = 0f; waterToWalk = 1f; roadToRoad = 0f; roadToWalk = 5f; walkToWalk = 5f; break; case Biomes.Swamp: break; case Biomes.Forest: break; case Biomes.City: grassToGrass = 2f; grassToWater = 0f; grassToRoad = 10f; grassToWalk = 2f; waterToWater = 1f; waterToRoad = 10f; waterToWalk = 1f; roadToRoad = 15f; roadToWalk = 5f; walkToWalk = 2f; break; case Biomes.Start: grassToGrass = 10f; grassToWater = 5f; grassToRoad = 5f; grassToWalk = 2f; waterToWater = 10f; waterToRoad = 1f; waterToWalk = 1f; roadToRoad = 15f; roadToWalk = 5f; walkToWalk = 5f; break; } }
private void RandomBiome() { activeBiome = terrainBiomes[Random.Range(0, terrainBiomes.Count)]; }
public Overworld.MapData[,] CreateMap() { int sx = Biomes.GetLength(0); int sy = Biomes.GetLength(1); Overworld.MapData[,] toReturn = new Overworld.MapData[Biomes.GetLength(0), Biomes.GetLength(1)]; for (int x = 0; x < sx; x++) { for (int y = 0; y < sy; y++) { toReturn[x, y] = new Overworld.MapData { Biome = (Overworld.Biome)Biomes[x, y], Erosion = Erosion[x, y], Faults = Faults[x, y], Height = Height[x, y], Rainfall = Rainfall[x, y], Temperature = Temperature[x, y], Water = (Overworld.WaterType)(Water[x, y]), Weathering = Weathering[x, y] }; } } return(toReturn); }
public PlainsDecorator(Biomes biome, Chunk chunk, Vector surfacePos, BaseBiomeNoise noise) : base(biome, chunk, surfacePos, noise) { Features.Trees.Add(new DecoratorFeatures.TreeInfo(1, typeof(OakTree))); Features.Trees.Add(new DecoratorFeatures.TreeInfo(1, typeof(AcaciaTree))); }
public TallBirchForestDecorator(Biomes biome, Chunk chunk, Vector surfacePos, BaseBiomeNoise noise) : base(biome, chunk, surfacePos, noise) { Features.Trees.Add(new DecoratorFeatures.TreeInfo(6, typeof(BirchTree))); }
public DarkForestDecorator(Biomes biome, Chunk chunk, Vector surfacePos, BaseBiomeNoise noise) : base(biome, chunk, surfacePos, noise) { Features.Trees.Add(new DecoratorFeatures.TreeInfo(5, typeof(DarkOakTree))); }
public DefaultDecorator(Biomes biome) : base(biome) { }
public void DetermineBaseBiome() { if (humidity < 0) humidity = 0; if (humidity > 4) humidity = 4; if (temperature < 0) temperature = 0; if (temperature > 4) temperature = 4; if (humidity >= 0 && humidity <= 1) { if (temperature >= 0 && temperature <= 1) baseBiome = Biomes.Tundra; // tundra else if (temperature > 1 && temperature <= 3) baseBiome = Biomes.Dirt; // dirt else if (temperature > 3 && temperature <= 4) baseBiome = Biomes.Desert; // desert } else if (humidity > 1 && humidity <= 2) { if (temperature >= 0 && temperature <= 1) baseBiome = Biomes.Snow; // snow else if (temperature >= 1 && temperature <= 2) baseBiome = Biomes.Forest; // forest else if (temperature > 2 && temperature <= 3) baseBiome = Biomes.Plains; // planes else if (temperature > 3 && temperature <= 4) baseBiome = Biomes.Desert; // desert } else if (humidity > 2 && humidity <= 3) { if (temperature >= 0 && temperature <= 1) baseBiome = Biomes.Snow; // snow else if (temperature > 1 && temperature <= 3) baseBiome = Biomes.Plains; // planes else if (temperature > 3 && temperature <= 4) baseBiome = Biomes.Jungle; // jungle } else if (humidity > 3 && humidity <= 4) { if (temperature >= 0 && temperature <= 1) baseBiome = Biomes.Glacier; // glacier else if (temperature > 1 && temperature <= 4) baseBiome = Biomes.Jungle; // sand } }
public SnowyTaigaDecorator(Biomes biome) : base(biome) { }
public void SetBiome(int bx, int by, int bz, Biomes biome) { Biomes[GetIndex(bx, by, bz)] = (int)biome; }
public PlainsDecorator(Biomes biome) : base(biome) { }
public DesertHillsDecorator(Biomes biome) : base(biome) { }
private void buttonBiomes_Click(object sender, RoutedEventArgs e) { Biomes Window = new Biomes(); Window.Show(); }
public static BiomeSettings GetBiomeSettings(Biomes biome) { var newBiomeSettings = new BiomeSettings(); switch (biome) { case Biomes.Tundra: newBiomeSettings.TargetHumidity = Tundra.TargetHumidity; newBiomeSettings.TargetTemperature = Tundra.TargetTemperature; newBiomeSettings.DefaultBlocktype = Tundra.DefaultBlocktype; newBiomeSettings.TopLayerType = Tundra.TopLayerType; newBiomeSettings.UnderLayerType = Tundra.UnderLayerType; newBiomeSettings.Mountains = Tundra.Mountains; newBiomeSettings.TerrainAmplitude = Tundra.TerrainAmplitude; newBiomeSettings.TopLayerThickness = Tundra.TopLayerThickness; newBiomeSettings.TreeModel = Tundra.TreeModel; newBiomeSettings.TreeRate = Tundra.TreeRate; newBiomeSettings.DecorationModel = Tundra.DecorationModel; newBiomeSettings.DecorationRate = Tundra.DecorationRate; break; case Biomes.BorealForest: newBiomeSettings.TargetHumidity = BorealForest.TargetHumidity; newBiomeSettings.TargetTemperature = BorealForest.TargetTemperature; newBiomeSettings.DefaultBlocktype = BorealForest.DefaultBlocktype; newBiomeSettings.TopLayerType = BorealForest.TopLayerType; newBiomeSettings.UnderLayerType = BorealForest.UnderLayerType; newBiomeSettings.Mountains = BorealForest.Mountains; newBiomeSettings.TerrainAmplitude = BorealForest.TerrainAmplitude; newBiomeSettings.TopLayerThickness = BorealForest.TopLayerThickness; newBiomeSettings.TreeModel = BorealForest.TreeModel; newBiomeSettings.TreeRate = BorealForest.TreeRate; newBiomeSettings.DecorationModel = BorealForest.DecorationModel; newBiomeSettings.DecorationRate = BorealForest.DecorationRate; break; case Biomes.Woodlands: newBiomeSettings.TargetHumidity = Woodlands.TargetHumidity; newBiomeSettings.TargetTemperature = Woodlands.TargetTemperature; newBiomeSettings.DefaultBlocktype = Woodlands.DefaultBlocktype; newBiomeSettings.TopLayerType = Woodlands.TopLayerType; newBiomeSettings.UnderLayerType = Woodlands.UnderLayerType; newBiomeSettings.Mountains = Woodlands.Mountains; newBiomeSettings.TerrainAmplitude = Woodlands.TerrainAmplitude; newBiomeSettings.TopLayerThickness = Woodlands.TopLayerThickness; newBiomeSettings.TreeModel = Woodlands.TreeModel; newBiomeSettings.TreeRate = Woodlands.TreeRate; newBiomeSettings.DecorationModel = Woodlands.DecorationModel; newBiomeSettings.DecorationRate = Woodlands.DecorationRate; break; case Biomes.ColdDesert: newBiomeSettings.TargetHumidity = ColdDesert.TargetHumidity; newBiomeSettings.TargetTemperature = ColdDesert.TargetTemperature; newBiomeSettings.DefaultBlocktype = ColdDesert.DefaultBlocktype; newBiomeSettings.TopLayerType = ColdDesert.TopLayerType; newBiomeSettings.UnderLayerType = ColdDesert.UnderLayerType; newBiomeSettings.Mountains = ColdDesert.Mountains; newBiomeSettings.TerrainAmplitude = ColdDesert.TerrainAmplitude; newBiomeSettings.TopLayerThickness = ColdDesert.TopLayerThickness; newBiomeSettings.TreeModel = ColdDesert.TreeModel; newBiomeSettings.TreeRate = ColdDesert.TreeRate; newBiomeSettings.DecorationModel = ColdDesert.DecorationModel; newBiomeSettings.DecorationRate = ColdDesert.DecorationRate; break; case Biomes.Desert: newBiomeSettings.TargetHumidity = Desert.TargetHumidity; newBiomeSettings.TargetTemperature = Desert.TargetTemperature; newBiomeSettings.DefaultBlocktype = Desert.DefaultBlocktype; newBiomeSettings.TopLayerType = Desert.TopLayerType; newBiomeSettings.UnderLayerType = Desert.UnderLayerType; newBiomeSettings.Mountains = Desert.Mountains; newBiomeSettings.TerrainAmplitude = Desert.TerrainAmplitude; newBiomeSettings.TopLayerThickness = Desert.TopLayerThickness; newBiomeSettings.TreeModel = Desert.TreeModel; newBiomeSettings.TreeRate = Desert.TreeRate; newBiomeSettings.DecorationModel = Desert.DecorationModel; newBiomeSettings.DecorationRate = Desert.DecorationRate; break; case Biomes.Savanna: newBiomeSettings.TargetHumidity = Savanna.TargetHumidity; newBiomeSettings.TargetTemperature = Savanna.TargetTemperature; newBiomeSettings.DefaultBlocktype = Savanna.DefaultBlocktype; newBiomeSettings.TopLayerType = Savanna.TopLayerType; newBiomeSettings.UnderLayerType = Savanna.UnderLayerType; newBiomeSettings.Mountains = Savanna.Mountains; newBiomeSettings.TerrainAmplitude = Savanna.TerrainAmplitude; newBiomeSettings.TopLayerThickness = Savanna.TopLayerThickness; newBiomeSettings.TreeModel = Savanna.TreeModel; newBiomeSettings.TreeRate = Savanna.TreeRate; newBiomeSettings.DecorationModel = Savanna.DecorationModel; newBiomeSettings.DecorationRate = Savanna.DecorationRate; break; case Biomes.RainForest: newBiomeSettings.TargetHumidity = RainForest.TargetHumidity; newBiomeSettings.TargetTemperature = RainForest.TargetTemperature; newBiomeSettings.DefaultBlocktype = RainForest.DefaultBlocktype; newBiomeSettings.TopLayerType = RainForest.TopLayerType; newBiomeSettings.UnderLayerType = RainForest.UnderLayerType; newBiomeSettings.Mountains = RainForest.Mountains; newBiomeSettings.TerrainAmplitude = RainForest.TerrainAmplitude; newBiomeSettings.TopLayerThickness = RainForest.TopLayerThickness; newBiomeSettings.TreeModel = RainForest.TreeModel; newBiomeSettings.TreeRate = RainForest.TreeRate; newBiomeSettings.DecorationModel = RainForest.DecorationModel; newBiomeSettings.DecorationRate = RainForest.DecorationRate; break; case Biomes.TropicRainForest: newBiomeSettings.TargetHumidity = TropicRainForest.TargetHumidity; newBiomeSettings.TargetTemperature = TropicRainForest.TargetTemperature; newBiomeSettings.DefaultBlocktype = TropicRainForest.DefaultBlocktype; newBiomeSettings.TopLayerType = TropicRainForest.TopLayerType; newBiomeSettings.UnderLayerType = TropicRainForest.UnderLayerType; newBiomeSettings.Mountains = TropicRainForest.Mountains; newBiomeSettings.TerrainAmplitude = TropicRainForest.TerrainAmplitude; newBiomeSettings.TopLayerThickness = TropicRainForest.TopLayerThickness; newBiomeSettings.TreeModel = TropicRainForest.TreeModel; newBiomeSettings.TreeRate = TropicRainForest.TreeRate; newBiomeSettings.DecorationModel = TropicRainForest.DecorationModel; newBiomeSettings.DecorationRate = TropicRainForest.DecorationRate; break; case Biomes.Forest: newBiomeSettings.TargetHumidity = Forest.TargetHumidity; newBiomeSettings.TargetTemperature = Forest.TargetTemperature; newBiomeSettings.DefaultBlocktype = Forest.DefaultBlocktype; newBiomeSettings.TopLayerType = Forest.TopLayerType; newBiomeSettings.UnderLayerType = Forest.UnderLayerType; newBiomeSettings.Mountains = Forest.Mountains; newBiomeSettings.TerrainAmplitude = Forest.TerrainAmplitude; newBiomeSettings.TopLayerThickness = Forest.TopLayerThickness; newBiomeSettings.TreeModel = Forest.TreeModel; newBiomeSettings.TreeRate = Forest.TreeRate; newBiomeSettings.DecorationModel = Forest.DecorationModel; newBiomeSettings.DecorationRate = Forest.DecorationRate; break; } return(newBiomeSettings); }
public BadlandsPlateauDecorator(Biomes biome) : base(biome) { }
public FrozenRiverDecorator(Biomes biome) : base(biome) { }
public virtual void AddBiome(Biome biome) { Biomes.Add(biome); Biomes.Sort((a, b) => a.Priority.CompareTo(b.Priority)); }
public WoodedMountainsDecorator(Biomes biome) : base(biome) { }