Exemple #1
0
        public override ILandObject Clone()
        {
            WaterLandObject waterLandObject = new WaterLandObject(this.Position.X, this.Position.Y, this.Altitude);

            waterLandObject.SetLandTransition(this.LandTransition);

            return(waterLandObject);
        }
Exemple #2
0
        public override int GenerateLandLayer(WorldGenerator worldGenerator, ILandChunk landChunk, IntRect area, int seed, int minAltitude, int maxAltitude)
        {
            ALandLayerGenerator altitudeLandLayerGenerator = worldGenerator.Generators["altitude"];

            bool isThereWater = false;

            this.ConstructAltitudeArea(worldGenerator, area);

            for (int i = 0; i < area.Height; i++)
            {
                for (int j = 0; j < area.Width; j++)
                {
                    int altitude = this.powerArea[i + 1, j + 1];

                    int[,] subAreaInt = new int[3, 3];
                    int maxLocalAltitude = int.MinValue;

                    maxLocalAltitude = this.GetComputedMatrix(i, j, ref subAreaInt);

                    for (int z = altitude; z <= 0; z++)
                    {
                        this.GetComputedLandType(area, ref subAreaInt, maxLocalAltitude, out LandTransition landTransition);

                        WaterLandObject waterLandObject = new WaterLandObject(area.Left + j, area.Top + i, z);
                        waterLandObject.SetLandTransition(landTransition);

                        landChunk.InitializeLandCase(i, j, z);
                        landChunk.GetLandCase(i, j, z).LandWater = waterLandObject;
                        isThereWater = true;

                        subAreaInt[1, 1]++;
                    }
                }
            }

            if (isThereWater)
            {
                landChunk.AddTypeInChunk(typeof(WaterLandObject));
            }

            return(seed);
        }