コード例 #1
0
ファイル: DunesBiome.cs プロジェクト: egshels/Sources
        private static void PlaceHill(
            int startX,
            int endX,
            float scale,
            DunesBiome.DunesDescription description)
        {
            Point startPoint = new Point(startX, (int)description.Surface[startX]);
            Point endPoint   = new Point(endX, (int)description.Surface[endX]);
            Point point1     = new Point((startPoint.X + endPoint.X) / 2, (startPoint.Y + endPoint.Y) / 2 - (int)(35.0 * (double)scale));
            int   num        = (endPoint.X - point1.X) / 4;
            int   minValue   = (endPoint.X - point1.X) / 16;

            if (description.WindDirection == DunesBiome.WindDirection.Left)
            {
                point1.X -= WorldGen.genRand.Next(minValue, num + 1);
            }
            else
            {
                point1.X += WorldGen.genRand.Next(minValue, num + 1);
            }
            Point point2 = new Point(0, (int)((double)scale * 12.0));
            Point point3 = new Point(point2.X / -2, point2.Y / -2);

            DunesBiome.PlaceCurvedLine(startPoint, point1, description.WindDirection != DunesBiome.WindDirection.Left ? point3 : point2, description);
            DunesBiome.PlaceCurvedLine(point1, endPoint, description.WindDirection == DunesBiome.WindDirection.Left ? point3 : point2, description);
        }
コード例 #2
0
ファイル: DunesBiome.cs プロジェクト: egshels/Sources
        private void PlaceSingle(DunesBiome.DunesDescription description, StructureMap structures)
        {
            int num1 = GenBase._random.Next(3) + 8;

            for (int index = 0; index < num1 - 1; ++index)
            {
                int   num2 = (int)(2.0 / (double)num1 * (double)description.Area.Width);
                int   num3 = (int)((double)index / (double)num1 * (double)description.Area.Width + (double)description.Area.Left) + num2 * 2 / 5 + GenBase._random.Next(-5, 6);
                float num4 = (float)(1.0 - (double)Math.Abs((float)index / (float)(num1 - 2) - 0.5f) * 2.0);
                DunesBiome.PlaceHill(num3 - num2 / 2, num3 + num2 / 2, (float)((double)num4 * 0.300000011920929 + 0.200000002980232) * this._heightScale, description);
            }
            int num5 = GenBase._random.Next(2) + 1;

            for (int index = 0; index < num5; ++index)
            {
                int num2 = description.Area.Width / 2;
                int num3 = description.Area.Center.X + GenBase._random.Next(-10, 11);
                DunesBiome.PlaceHill(num3 - num2 / 2, num3 + num2 / 2, 0.8f * this._heightScale, description);
            }
            structures.AddStructure(description.Area, 20);
        }