Пример #1
0
        public override int GenerateLandLayer(WorldGenerator worldGenerator, ILandChunk landChunk, IntRect area, int seed, int minAltitude, int maxAltitude)
        {
            ALandLayerGenerator altitudeLandLayerGenerator = worldGenerator.Generators["altitude"];

            ALandLayerGenerator cliffLandLayerGenerator = worldGenerator.Generators["cliff"];

            bool[,] subArea = new bool[3, 3];

            for (int i = 0; i < area.Height; i++)
            {
                for (int j = 0; j < area.Width; j++)
                {
                    this.GetComputedLandType(altitudeLandLayerGenerator, area, i, j, out LandType landType, out LandType secondType, out LandTransition landTransition);

                    int altitude = altitudeLandLayerGenerator.GetComputedPowerAt(j, i);

                    int altitudeOffset = cliffLandLayerGenerator.GetComputedPowerAt(j, i);

                    GroundLandObject groundLandObject = new GroundLandObject(area.Left + j, area.Top + i, altitude, landType);

                    GroundLandObject secondGroundLandObject = new GroundLandObject(area.Left + j, area.Top + i, altitude, secondType);
                    secondGroundLandObject.SetTransition(landTransition);

                    AssignGround(landChunk, i, j, altitude, altitudeOffset, groundLandObject, secondGroundLandObject);

                    this.powerArea[i + 2, j + 2] = (int)this.GetLandTypeFromPower(altitude);
                }
            }

            landChunk.AddTypeInChunk(typeof(GroundLandObject));

            return(seed);
        }
Пример #2
0
        public override ILandObject Clone()
        {
            GroundLandObject groundLandObject = new GroundLandObject(this.Position.X, this.Position.Y, this.Altitude, this.Type);

            groundLandObject.SetTransition(this.LandTransition);

            return(groundLandObject);
        }
Пример #3
0
        public override ILandObject Clone(LandTransition wallLandTransition)
        {
            LandTransition landTransitionOverWall = this.GetLandTransitionOverWall(wallLandTransition);

            if (landTransitionOverWall != LandTransition.NONE)
            {
                GroundLandObject groundLandObject = new GroundLandObject(this.Position.X, this.Position.Y, this.Altitude, this.Type);
                groundLandObject.SetTransition(landTransitionOverWall);

                return(groundLandObject);
            }
            return(null);
        }