Beispiel #1
0
        public List <Location> getAllLocations()
        {
            List <Location> locations = new List <Location>();

            locations.Add(FirstCity.getFirstCity());
            locations.Add(new SewerSub1());
            locations.Add(SewerSub2.getSewerSub2());
            locations.Add(OakForest.getOakForest());
            locations.Add(LeakDesert.getLeakDesert());



            return(locations);
        }
        public Block(int _x, int _z, Vector3 chunkPosition, float _Height, Chunk chunk)
        {
            index = 0;
            x     = _x;
            z     = _z;

            float xDistance = (float)Math.Pow(Math.Abs(x), 2);
            float yDistance = (float)Math.Pow(Math.Abs(z), 2);
            float distance  = (float)Math.Sqrt(xDistance + yDistance) / 500f;

            height = _Height - distance;

            Chunk = chunkPosition;

            #region BiomeGen
            HeatType     HeatType;
            MoistureType MoistureType;

            float XX = x;
            float ZZ = z;

            MidleWorld.biomeNoise.GradientPerturbFractal(ref XX, ref ZZ);

            heatValue     = Math.Abs(MidleWorld.biomeNoise.GetCellular(XX, ZZ));
            MoistureValue = Math.Abs(MidleWorld.biomeNoise.GetCellular(XX, ZZ));

            if (heatValue <= GlobalData.ColdestValue)
            {
                HeatType = HeatType.Coldest;
            }
            else if (heatValue <= GlobalData.ColderValue)
            {
                HeatType = HeatType.Colder;
            }
            else if (heatValue <= GlobalData.ColdValue)
            {
                HeatType = HeatType.Cold;
            }
            else if (heatValue <= GlobalData.WarmValue)
            {
                HeatType = HeatType.Warm;
            }
            else if (heatValue <= GlobalData.WarmerValue)
            {
                HeatType = HeatType.Warmer;
            }
            else
            {
                HeatType = HeatType.Warmest;
            }
            ///
            if (MoistureValue <= GlobalData.DryerValue)
            {
                MoistureType = MoistureType.Dryer;
            }
            else if (MoistureValue <= GlobalData.DryValue)
            {
                MoistureType = MoistureType.Dry;
            }
            else if (MoistureValue <= GlobalData.WetValue)
            {
                MoistureType = MoistureType.Wet;
            }
            else if (MoistureValue <= GlobalData.WetterValue)
            {
                MoistureType = MoistureType.Wetter;
            }
            else if (MoistureValue <= GlobalData.WettestValue)
            {
                MoistureType = MoistureType.Wettest;
            }
            else
            {
                MoistureType = MoistureType.Wettest;
            }

            TileBiome = GlobalData.BiomeTable[(int)MoistureType, (int)HeatType];
            //TileBiome = BiomeType.Woodland;
            #endregion

            treeType = TreeType.none;
            Type     = TypeBlock.Air;

            if (height <= 0 && height >= -2f)
            {
                TileBiome = BiomeType.Bench;
                Type      = TypeBlock.Sand;
            }
            else if (height < -2f)
            {
                TileBiome = BiomeType.Ocean;
                Type      = TypeBlock.Sand;
            }
            else
            {
                BiomeData biomeData;

                switch (TileBiome)
                {
                case BiomeType.Grassland:
                    biomeData           = OakForest.GetBiome(x, z, chunk);
                    biomeData._treeType = TreeType.none;
                    break;

                case BiomeType.Desert:
                    biomeData            = OakForest.GetBiome(x, z, chunk);
                    biomeData._treeType  = TreeType.none;
                    biomeData._typeBlock = TypeBlock.Sand;
                    break;

                case BiomeType.TropicalRainforest:
                    biomeData           = OakForest.GetBiome(x, z, chunk);
                    biomeData._treeType = TreeType.none;
                    break;

                case BiomeType.Savanna:
                    biomeData           = OakForest.GetBiome(x, z, chunk);
                    biomeData._treeType = TreeType.none;
                    break;

                case BiomeType.Ice:
                    biomeData = SnowForest.GetBiome(x, z, chunk);
                    break;

                case BiomeType.Tundra:
                    biomeData            = OakForest.GetBiome(x, z, chunk);
                    biomeData._treeType  = TreeType.none;
                    biomeData._typeBlock = TypeBlock.Grass;
                    break;

                case BiomeType.Woodland:
                    biomeData = OakForest.GetBiome(x, z, chunk);
                    break;

                case BiomeType.Bench:
                    biomeData           = OakForest.GetBiome(x, z, chunk);
                    biomeData._treeType = TreeType.none;
                    break;

                default:
                    biomeData           = OakForest.GetBiome(x, z, chunk);
                    biomeData._treeType = TreeType.none;
                    break;
                }

                Type     = biomeData._typeBlock;
                treeType = biomeData._treeType;
                height   = Math.Abs(biomeData._Height + _Height / 10f);
            }
        }