Exemple #1
0
            public override void Generate(Random rand, int prob)
            {
                if (this.Orientation == Generator.Orientation.Vertical)
                {
                    this.North = GetBlockAt(this.X, this.Y - 1);

                    if (North == null && rand.Next(0, 100) < prob && IsInsideCity(this.X, this.Y - 1))
                    {
                        North = new CitySquareBlock(rand, this.IdSeed, City, this.X, this.Y - 1);
                        North.Generate(rand, prob - 1);
                    }

                    this.South = GetBlockAt(this.X, this.Y + 1);

                    if (South == null && rand.Next(0, 100) < prob && IsInsideCity(this.X, this.Y + 1))
                    {
                        South = new CitySquareBlock(rand, this.IdSeed, City, this.X, this.Y - 1);
                        South.Generate(rand, prob - 1);
                    }

                    //this.East = GetBlockAt(this.X + 1, this.Y);

                    //if (East == null && rand.Next(0, 100) < prob && IsInsideCity(this.X + 1, this.Y)) {
                    //    East = new CitySquareBlock(rand, City, this.X + 1, this.Y);
                    //    East.Generate(rand, prob - 1);
                    //}

                    //this.West = GetBlockAt(this.X - 1, this.Y);

                    //if (West == null && rand.Next(0, 100) < prob && IsInsideCity(this.X - 1, this.Y)) {
                    //    West = new CitySquareBlock(rand, City, this.X - 1, this.Y);
                    //    West.Generate(rand, prob - 1);
                    //}
                }

                if (this.Orientation == Generator.Orientation.Horizontal)
                {
                    //this.North = GetBlockAt(this.X, this.Y - 1);

                    //if (North == null && rand.Next(0, 100) < prob && IsInsideCity(this.X, this.Y - 1)) {
                    //    North = new CitySquareBlock(rand, City, this.X, this.Y - 1);
                    //    North.Generate(rand, prob - 1);
                    //}

                    //this.South = GetBlockAt(this.X, this.Y + 1);

                    //if (South == null && rand.Next(0, 100) < prob && IsInsideCity(this.X, this.Y + 1)) {
                    //    South = new CitySquareBlock(rand, City, this.X, this.Y - 1);
                    //    South.Generate(rand, prob - 1);
                    //}


                    this.East = GetBlockAt(this.X + 1, this.Y);

                    if (East == null && rand.Next(0, 100) < prob && IsInsideCity(this.X + 1, this.Y))
                    {
                        East = new CitySquareBlock(rand, this.IdSeed, City, this.X + 1, this.Y);
                        East.Generate(rand, prob - 1);
                    }

                    this.West = GetBlockAt(this.X - 1, this.Y);

                    if (West == null && rand.Next(0, 100) < prob && IsInsideCity(this.X - 1, this.Y))
                    {
                        West = new CitySquareBlock(rand, this.IdSeed, City, this.X - 1, this.Y);
                        East.Generate(rand, prob - 1);
                    }
                }
            }