예제 #1
0
        public override ILandObject Clone()
        {
            AltitudeLandObject altitudeLandObject = new AltitudeLandObject(this.Position.X, this.Position.Y, this.Altitude, this.landType);

            altitudeLandObject.SetLandTransition(this.LandTransition);

            return(altitudeLandObject);
        }
예제 #2
0
        public override ILandObject Clone(LandTransition wallLandTransition)
        {
            LandTransition landTransitionOverWall = this.GetLandTransitionOverWall(wallLandTransition);

            if (landTransitionOverWall != LandTransition.NONE)
            {
                AltitudeLandObject altitudeLandObject = new AltitudeLandObject(this.Position.X, this.Position.Y, this.Altitude, this.landType);
                altitudeLandObject.SetLandTransition(landTransitionOverWall);

                return(altitudeLandObject);
            }
            return(null);
        }
예제 #3
0
        public override int GenerateLandLayer(WorldGenerator worldGenerator, ILandChunk landChunk, IntRect area, int seed, int minAltitude, int maxAltitude)
        {
            ALandLayerGenerator altitudeLandLayerGenerator = worldGenerator.Generators["altitude"];

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

            this.powerArea = new int[area.Height + 4, area.Width + 4];

            for (int i = 0; i < area.Height; i++)
            {
                for (int j = 0; j < area.Width; j++)
                {
                    int[,] subAreaInt = new int[3, 3];
                    int maxLocalAltitude = int.MinValue;

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

                    int diffAltitude = maxLocalAltitude - subAreaInt[1, 1];

                    this.powerArea[i + 2, j + 2] = diffAltitude;

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

                        if (landTransition != LandTransition.NONE)
                        {
                            AltitudeLandObject altitudeLandObject = new AltitudeLandObject(area.Left + j, area.Top + i, subAreaInt[1, 1], LandType.GRASS);

                            landChunk.InitializeLandCase(i, j, subAreaInt[1, 1]);
                            landChunk.GetLandCase(i, j, subAreaInt[1, 1]).LandWall = altitudeLandObject;

                            altitudeLandObject.SetLandTransition(landTransition);
                        }

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

            landChunk.AddTypeInChunk(typeof(AltitudeLandObject));

            return(seed);
        }