public SurfaceVanillaBeach(BiomeConfig config, Pixel top, Pixel filler, Pixel cliff1, Pixel cliff2, byte metadata, int cliff) : base(config, Pixels.DIRT, Pixels.DIRT) { cliffPixel1 = Pixels.DIRT; cliffPixel2 = Pixels.STONE; sandMetadata = metadata; cliffType = cliff; }
/// <inheritdoc /> public SavannaSurface(BiomeConfig config, Block top, Block filler, Block mix, float mixWidth, float mixHeight) : base(config, top, filler) { mixBlock = mix; width = mixWidth; height = mixHeight; }
public SurfaceIslandMountainStone(BiomeConfig config, Pixel top, Pixel fill, float minCliff, float stoneCliff, float stoneHeight, float stoneStrength, float clayCliff) : this(config, top, fill, minCliff) { sCliff = stoneCliff; sHeight = stoneHeight; sStrength = stoneStrength; cCliff = clayCliff; }
public static BiomeType GetBiome(int x, int z) { float height = World.FastNoise.GetSimplex(x / BiomeSize, z / BiomeSize) + 1; float temperature = World.FastNoise.GetSimplex((x / BiomeSize) * 0.1f, (z / BiomeSize) * 0.1f) + 1; float moistrue = World.FastNoise.GetSimplex((x / BiomeSize) * 0.25f, (z / BiomeSize) * 0.25f) + 1; BiomeType selectedType = BiomeType.PLAINS; float minDiff = float.MaxValue; for (int i = 0; i < biomeConfigs.Length; i++) { BiomeConfig config = biomeConfigs[i]; float diff = math.abs(config.Height - height) + math.abs(config.Temperature - temperature) + math.abs(config.Moistrue - moistrue); if (diff < minDiff) { minDiff = diff; selectedType = config.Type; } } return(selectedType); }
private GameObject GetBiomePrefab(int chunk, BiomeConfig biome, bool startNode) { PredictableRandom.SetSeed((uint)chunk, 0u); BiomeVariations biomeVariations = BindingManager.Instance.BiomeList.Biomes[biome.BiomeIndex]; if (startNode) { if (Singleton <TournamentRunner> .Instance.TournamentActive.Value && biomeVariations.TournamentBiomes[0] != null) { List <int> value = TournamentChunk.Value; value.Add(chunk); TournamentChunk.SetValueAndForceNotify(value); return(biomeVariations.TournamentBiomes[PredictableRandom.GetNextRangeInt(0, biomeVariations.TournamentBiomes.Length)]); } return(biomeVariations.StartBiomes[PredictableRandom.GetNextRangeInt(0, biomeVariations.StartBiomes.Length)]); } if (chunk % 3 == 0 && Singleton <TournamentRunner> .Instance.TournamentActive.Value && biomeVariations.TournamentBiomes[0] != null) { List <int> value2 = TournamentChunk.Value; value2.Add(chunk); TournamentChunk.SetValueAndForceNotify(value2); return(biomeVariations.TournamentBiomes[PredictableRandom.GetNextRangeInt(0, biomeVariations.TournamentBiomes.Length)]); } return(biomeVariations.InsertBiomes[PredictableRandom.GetNextRangeInt(0, biomeVariations.InsertBiomes.Length)]); }
private BiomeType GetBiome(int x, int z, out float height) { height = noise.GetSimplex(x / BiomeSize, z / BiomeSize) + 1; float temperature = noise.GetSimplex((x / BiomeSize) * 0.1f, (z / BiomeSize) * 0.1f) + 1; float moistrue = noise.GetSimplex((x / BiomeSize) * 0.25f, (z / BiomeSize) * 0.25f) + 1; BiomeType selectedType = BiomeType.PLAINS; float minDiff = float.MaxValue; for (int i = 0; i < biomeConfigs.Length; i++) { BiomeConfig config = biomeConfigs[i]; float diff = math.abs(config.Height - height) + math.abs(config.Temperature - temperature) + math.abs(config.Moistrue - moistrue); if (diff < minDiff) { minDiff = diff; selectedType = config.Type; } } //height -= 1; height *= height; return(selectedType); }
public SurfaceRiverBOPCrag(BiomeConfig config, Pixel top, Pixel filler, Pixel cliff1, Pixel cliff2) : base(config, top, filler) { topPixel = top; fillerPixel = filler; cliffPixel1 = cliff1; cliffPixel2 = cliff2; }
public SurfaceVanillaStoneBeach(BiomeConfig config, Pixel top, Pixel fill, float minCliff, float stoneCliff, float stoneHeight, float stoneStrength, float clayCliff) : this(config, top, fill, minCliff) { sCliff = stoneCliff; sHeight = stoneHeight; sStrength = stoneStrength; cCliff = clayCliff; }
private void UpdateBiomes(Vector3 pos, BiomeStart biomeStart = BiomeStart.Normal, int chunkFix = 0) { bool flag = biomeStart == BiomeStart.BaseCamp; bool flag2 = biomeStart == BiomeStart.StartNode; int num = (!flag) ? (-1) : 0; for (int i = num; i < 2; i++) { int z = Mathf.RoundToInt(pos.z) + i * 30; if (m_biomeQueue.ToList().Find((BiomePos b) => z == b.Z) == null) { int index = Singleton <WorldRunner> .Instance.CurrentChunk.Value.Index; BiomeConfig value = Singleton <WorldRunner> .Instance.CurrentBiomeConfig.Value; GameObject biome = (flag && i == 0) ? CreateBasecamp() : ((!flag2 || i != 0) ? CreateBiome(z, index + i + chunkFix, value, startNode: false) : CreateBiome(z, index + i + chunkFix, value, startNode: true)); m_biomeQueue.Enqueue(new BiomePos { Biome = biome, Z = z }); } } while (m_biomeQueue.Count() > 3) { BiomePos biomePos = m_biomeQueue.Dequeue(); UnityEngine.Object.DestroyObject(biomePos.Biome, 3f); } }
private IEnumerator StartPrestige() { SceneLoader root = SceneLoader.Instance; BindingManager bind = BindingManager.Instance; SequenceDone.Value = false; PrestigeTriggered.SetValueAndForceNotify(PrestigeOrder.PrestigeStart); PrestigeBasecampCameraDelay = 1f; int chunk = PlayerData.Instance.MainChunk.Value; BiomeConfig biome = Singleton <WorldRunner> .Instance.MainBiomeConfig.Value; Vector3 pos = bind.CameraCtrl.transform.position.x0z(); root.StartCoroutine(Singleton <ChunkRunner> .Instance.GeneratePrestigeChunks(pos, chunk, biome)); yield return(new WaitForSeconds(2f)); bind.PrestigeLoadingParent.ShowInfo(); yield return(new WaitForSeconds(1f)); bind.PrestigeBagContent.InitializeCards(); Observable.NextFrame().Subscribe(delegate { PrestigeTriggered.SetValueAndForceNotify(PrestigeOrder.PrestigeInit); PrestigeTriggered.SetValueAndForceNotify(PrestigeOrder.PrestigePost); PlayerData.Instance.LifetimePrestiges.Value++; PersistentSingleton <MainSaver> .Instance.PleaseSave("prestige_" + PlayerData.Instance.LifetimePrestiges.Value); }).AddTo(root); yield return(new WaitForSeconds(3f)); bind.PrestigeBagOpeningParent.SetActive(value: true); PrestigeBasecampCameraDelay = 0f; }
public RealisticBiomeBase(Biome biome, Biome river) { arrRealisticBiomeIds[biome.getBiomeID()] = this; baseBiome = biome; riverBiome = river; this.config = new BiomeConfig(); _beachBiome = this.beachBiome(); waterSurfaceLakeChance = 10; lavaSurfaceLakeChance = 0; // Disabled. waterUndergroundLakeChance = 1; lavaUndergroundLakeChance = 1; generateVillages = true; generatesEmeralds = false; generatesSilverfish = false; //rtgTrees = new ArrayList<>(); // set the water feature constants with the config changes this.lakeInterval *= rtgConfig.LAKE_FREQUENCY_MULTIPLIER; this.lakeWaterLevel *= rtgConfig.lakeSizeMultiplier(); this.lakeShoreLevel *= rtgConfig.lakeSizeMultiplier(); this.lakeDepressionLevel *= rtgConfig.lakeSizeMultiplier(); this.largeBendSize *= rtgConfig.LAKE_SHORE_BENDINESS_MULTIPLIER; this.mediumBendSize *= rtgConfig.LAKE_SHORE_BENDINESS_MULTIPLIER; this.smallBendSize *= rtgConfig.LAKE_SHORE_BENDINESS_MULTIPLIER; this.init(); }
public SurfaceDesertOasis(BiomeConfig config, Pixel top, Pixel filler, Pixel cliff1, Pixel cliff2, byte metadata, int cliff) : base(config, top, filler) { cliffPixel1 = cliff1; cliffPixel2 = cliff2; sandMetadata = metadata; cliffType = cliff; }
public SurfaceVanillaSavanna(BiomeConfig config, Pixel top, Pixel filler, Pixel mix, float mixWidth, float mixHeight) : base(config, top, filler) { mixPixel = this.getConfigPixel(config.SURFACE_MIX_PIXEL, config.SURFACE_MIX_PIXEL_META, mix); width = mixWidth; height = mixHeight; }
public IEnumerator GeneratePrestigeChunks(Vector3 pos, int chunk, BiomeConfig biome, BiomeStart biomestart = BiomeStart.Normal) { for (int i = 0; i < 15; i++) { int z = Mathf.RoundToInt(pos.z) - (i + 2) * 30; CreateBiome(z, chunk - (i + 2), biome, startNode: false); yield return(null); } }
public SurfaceGrasslandMix1(BiomeConfig config, Pixel top, Pixel filler, Pixel mix, Pixel cliff1, Pixel cliff2, float mixWidth, float mixHeight) : base(config, top, filler) { mixPixel = mix; cliffPixel1 = cliff1; cliffPixel2 = cliff2; width = mixWidth; height = mixHeight; }
public SurfaceBase(BiomeConfig config, Block top, Block filler) { BiomeConfig = config; TopBlock = top; FillerBlock = filler; CliffStoneBlock = new Stone(); CliffCobbleBlock = new Cobblestone(); }
/// <inheritdoc /> public MesaSurface(BiomeConfig config, Block top, Block filler) : base(config, top, filler) { mixBlock = new StainedHardenedClay() { Color = "orange" }; mix2Block = new RedSandstone(); }
public SurfaceVanillaRedwoodTaigaHills(BiomeConfig config, Pixel top, Pixel fill, float minCliff, float stoneCliff, float stoneHeight, float stoneStrength, float snowCliff, float snowHeight, float snowStrength, float clayCliff) : this(config, top, fill, minCliff) { sCliff = stoneCliff; sHeight = stoneHeight; sStrength = stoneStrength; iCliff = snowCliff; iHeight = snowHeight; iStrength = snowStrength; cCliff = clayCliff; }
public SurfaceMountainSnow(BiomeConfig config, Pixel top, Pixel fill, float minCliff, float stoneCliff, float stoneHeight, float stoneStrength, float snowCliff, float snowHeight, float snowStrength, float clayCliff) : this(config, top, fill, minCliff) { sCliff = stoneCliff; sHeight = stoneHeight; sStrength = stoneStrength; iCliff = snowCliff; iHeight = snowHeight; iStrength = snowStrength; cCliff = clayCliff; }
public SurfaceVanillaExtremeHills(BiomeConfig config, Pixel top, Pixel filler, Pixel mixTop, Pixel mixFill, float mixWidth, float mixHeight, float smallWidth, float smallStrength) : base(config, top, filler) { mixPixelTop = this.getConfigPixel(config.SURFACE_MIX_PIXEL, config.SURFACE_MIX_PIXEL_META, mixTop); mixPixelFill = this.getConfigPixel(config.SURFACE_MIX_FILLER_PIXEL, config.SURFACE_MIX_FILLER_PIXEL_META, mixFill); width = mixWidth; height = mixHeight; smallW = smallWidth; smallS = smallStrength; }
public SurfaceVanillaSavannaM(BiomeConfig config, Pixel top, Pixel fill, float minCliff, float stoneCliff, float stoneHeight, float stoneStrength, float clayCliff, Pixel mix) : base(config, top, fill) { min = minCliff; sCliff = stoneCliff; sHeight = stoneHeight; sStrength = stoneStrength; cCliff = clayCliff; mixPixel = this.getConfigPixel(config.SURFACE_MIX_PIXEL, config.SURFACE_MIX_PIXEL_META, mix); }
public SurfaceMountainStoneMix1(BiomeConfig config, Pixel top, Pixel fill, float minCliff, float stoneCliff, float stoneHeight, float stoneStrength, float clayCliff, Pixel mixPixel, float mixSize) : base(config, top, fill) { min = minCliff; sCliff = stoneCliff; sHeight = stoneHeight; sStrength = stoneStrength; cCliff = clayCliff; mix = mixPixel; mixHeight = mixSize; }
public SurfaceGrasslandMixBig(BiomeConfig config, Pixel top, Pixel filler, Pixel mixTop, Pixel mixFill, Pixel cliff1, Pixel cliff2, float mixWidth, float mixHeight, float smallWidth, float smallStrength) : base(config, top, filler) { mixPixelTop = mixTop; mixPixelFill = mixFill; cliffPixel1 = cliff1; cliffPixel2 = cliff2; width = mixWidth; height = mixHeight; smallW = smallWidth; smallS = smallStrength; }
private GameObject CreateBiome(int z, int relativeChunk, BiomeConfig biome, bool startNode) { Vector3 vector = new Vector3(0f, 0f, z); if (vegetation) { ChunkGenerator.GenerateVegetation(vector, BindingManager.Instance.BlockContainer); } GameObject gameObject = UnityEngine.Object.Instantiate(GetBiomePrefab(relativeChunk, biome, startNode), vector, Quaternion.identity); gameObject.transform.SetParent(BindingManager.Instance.BiomeContainer, worldPositionStays: true); return(gameObject); }
public SurfaceVanillaIceMountains(BiomeConfig config, Pixel top, Pixel filler, Pixel mixTop, Pixel mixFill, Pixel cliff1, Pixel cliff2, float mixWidth, float mixHeight, float smallWidth, float smallStrength) : base(config, top, filler) { mixPixelTop = this.getConfigPixel(config.SURFACE_MIX_PIXEL, config.SURFACE_MIX_PIXEL_META, mixTop); mixPixelFill = this.getConfigPixel(config.SURFACE_MIX_FILLER_PIXEL, config.SURFACE_MIX_FILLER_PIXEL_META, mixFill); cliffPixel1 = cliff1; cliffPixel2 = cliff2; width = mixWidth; height = mixHeight; smallW = smallWidth; smallS = smallStrength; }
/// <inheritdoc /> public JungleSurface(BiomeConfig config, Block top, Block filler, float minCliff, float stoneCliff, float stoneHeight, float stoneStrength, float clayCliff, Block mix, float mixSize) : base(config, top, filler) { min = minCliff; sCliff = stoneCliff; sHeight = stoneHeight; sStrength = stoneStrength; cCliff = clayCliff; mixBlock = mix; // this.getConfigBlock(config.SURFACE_MIX_BLOCK.get(), mix); mixHeight = mixSize; }
public SurfaceMesa(BiomeConfig config, Pixel top, byte topByte, Pixel fill, byte fillByte) : base(config, top, fill) { int[] c = new int[] { 1, 8, 0 }; OpenSimplexNoise simplex = new OpenSimplexNoise(2L); float n; for (int i = 0; i < 100; i++) { n = simplex.noise1(i / 3f) * 3f + simplex.noise1(i / 1f) * 0.3f + 1.5f; n = n >= 3f ? 2.9f : n < 0f ? 0f : n; claycolor[i] = c[(int)n]; } }
public SurfaceBase(BiomeConfig config, Pixel top, Pixel fill) { if (config == null) { throw new Exception("Biome config in SurfaceBase is NULL."); } biomeConfig = config; topPixel = top; fillerPixel = fill; this.initCliffPixels(); this.initShadowPixels(); this.assignUserConfigs(config, top, fill); }
private void GiveGoldReward() { int chunk = (PlayerData.Instance.MainChunk.Value <= PersistentSingleton <GameSettings> .Instance.DrillCoinMinimumConfig) ? PersistentSingleton <GameSettings> .Instance.DrillCoinMinimumConfig : PlayerData.Instance.MainChunk.Value; BiomeConfig biomeConfig = Singleton <EconomyHelpers> .Instance.GetBiomeConfig(chunk); BigDouble bigDouble = biomeConfig.BlockReward * PersistentSingleton <GameSettings> .Instance.DrillCoinMultiplier; Singleton <FundRunner> .Instance.AddCoins(bigDouble); Rewards.Add(new string[2] { BigString.ToString(bigDouble), "UI/BundleItems/BundleItem_Coins" }); }
/// <summary> /// Get the surface color considering biome and height. /// </summary> public Color GetBiomeColor(BiomeConfig biomeConfig, float elevation, float maxHeight, Vector3 pointOnUnitSphere, float ratio) { Noise noise = new Noise(); float biomeNoise = (noise.Evaluate(pointOnUnitSphere * biomeConfig.noiseScale) - biomeConfig.offset) * biomeConfig.distortion; float sampleTime = Mathf.Clamp(ratio + biomeNoise, 0.01f, 9.99f); float biomeValue = biomeConfig.gradient.Evaluate(sampleTime).r; #region explanation // STEP 0: Get theg gradients (Doesn't have to be 3) // ----------, ----------, ---------- // STEP 1: Stack the gradients ontop of eachother // ---------- (0) // ---------- (1) // ---------- (2) // STEP 2: Create a linear transition between, i.e smudge the borders // ~~~~~~~~~~ (0) // ~~~~~~~~~~ (1) // ~~~~~~~~~~ (2) // STEP 3: Select a horizontal slice of the stack at a specified depth. This is the final gradient. // ~~~~~~~~~~ (0) // ~~~~~~~~~~ (1) // ~~~~~~~~~~ (2) // SELECTED GRADIENT (----------) AT DEPTH 1.35 #endregion Gradient gradient = new Gradient(); Biome[] biomes = biomeConfig.biomes; GradientColorKey[] colorKeys = new GradientColorKey[biomes.Length]; for (int j = 0; j < colorKeys.Length; j++) { colorKeys[j].time = biomes[j].order; colorKeys[j].color = biomes[j].gradient.Evaluate(elevation / maxHeight); } GradientAlphaKey[] alphaKeys = new GradientAlphaKey[2]; alphaKeys[0].alpha = 1.0f; alphaKeys[1].alpha = 1.0f; gradient.SetKeys(colorKeys, alphaKeys); return(gradient.Evaluate(biomeValue)); }