Esempio n. 1
0
        public override ILandObject Clone()
        {
            MountainLandObject grassLandObject = new MountainLandObject(this.Position.X, this.Position.Y, this.Altitude, this.LandMountainType);

            grassLandObject.SetTransition(this.LandTransition);

            return(grassLandObject);
        }
Esempio n. 2
0
        public override ILandObject Clone(LandTransition wallLandTransition)
        {
            LandTransition landTransitionOverWall = this.GetLandTransitionOverWall(wallLandTransition);

            if (landTransitionOverWall != LandTransition.NONE)
            {
                MountainLandObject grassLandObject = new MountainLandObject(this.Position.X, this.Position.Y, this.Altitude, this.LandMountainType);
                grassLandObject.SetTransition(landTransitionOverWall);

                return(grassLandObject);
            }
            return(null);
        }
Esempio n. 3
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];

            bool isThereMountain = false;

            this.ConstructMountainArea(worldGenerator, area);

            for (int i = 0; i < area.Height; i++)
            {
                for (int j = 0; j < area.Width; j++)
                {
                    int altitude = altitudeLandLayerGenerator.GetComputedPowerAt(j, i);

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

                    if ((altitude > 6 || (altitude == 6 && altitudeOffset > 0)) &&
                        altitude < 23)
                    {
                        LandCreationHelper.GetComputedLandType(this, area, i, j, out int mountainTypeInt, out int secondTypeInt, out LandTransition landTransition, out LandTransition secondLandTransition);
                        //this.GetComputedLandType(area, i, j, out MountainType mountainType, out MountainType secondType, out LandTransition landTransition, out LandTransition secondLandTransition);

                        MountainType mountainType = (MountainType)mountainTypeInt;
                        MountainType secondType   = (MountainType)secondTypeInt;

                        MountainLandObject groundLandObject       = null;
                        MountainLandObject secondGroundLandObject = null;

                        if (mountainType != MountainType.NONE)
                        {
                            groundLandObject = new MountainLandObject(area.Left + j, area.Top + i, altitude, mountainType);
                            groundLandObject.SetTransition(landTransition);

                            isThereMountain = true;
                        }

                        if (secondType != mountainType && secondType != MountainType.NONE)
                        {
                            secondGroundLandObject = new MountainLandObject(area.Left + j, area.Top + i, 0, secondType);
                            secondGroundLandObject.SetTransition(secondLandTransition);

                            isThereMountain = true;
                        }

                        bool onlyGround = altitude == 22 && altitudeOffset > 0;
                        AssignGround(landChunk, i, j, altitude, altitudeOffset, groundLandObject, secondGroundLandObject, onlyGround);
                    }
                }
            }

            if (isThereMountain)
            {
                landChunk.AddTypeInChunk(typeof(MountainLandObject));
            }

            return(seed);
        }