private static void ChooseWallBounds(GenerationRandom genRan, Blacksmith smith) { ChooseLShapedWall(genRan, smith); return; if (genRan.RandomBool()) { ChooseLShapedWall(genRan, smith); } else { ChooseHalfCutWall(genRan, smith); } /* * //Define a base rectangular wall * List<Vec2i> wallPoints = new List<Vec2i>(); * wallPoints.Add(new Vec2i(0, 0)); * wallPoints.Add(new Vec2i(smith.Width-1, 0)); * wallPoints.Add(new Vec2i(smith.Width-1, smith.Height-1)); * wallPoints.Add(new Vec2i(0, smith.Height-1)); * * * * //Choose which point index we wish to move * int deltaPointI = genRan.RandomInt(0, wallPoints.Count); * //We find which direction and amount the point has to move to not leave the bounds * int xDir = (wallPoints[deltaPointI].x == 0 ? 1 : -1) * genRan.RandomInt(smith.Width / 4, smith.Width - smith.Width / 3); * int zDir =(wallPoints[deltaPointI].z == 0 ? 1 : -1) * genRan.RandomInt(smith.Height/4, smith.Height - smith.Height/3); * Vec2i newPoint = new Vec2i(xDir, zDir) + wallPoints[deltaPointI]; * * //wallPoints.Insert(deltaPointI-1, newPoint); * //We find the direction from the previous corner to this one, * //we use this to translate the point accordingly * Vec2i nm1_to_n = wallPoints[deltaPointI] - wallPoints[(deltaPointI - 1 + wallPoints.Count) % wallPoints.Count]; * Vec2i np1_to_n = wallPoints[(deltaPointI + 1) % wallPoints.Count] - wallPoints[deltaPointI]; * * if (nm1_to_n.x == 0) * { * wallPoints[deltaPointI].z = newPoint.z; * } * else * { * wallPoints[deltaPointI].x = newPoint.x; * } * * // Vec2i np1_to_n = wallPoints[(deltaPointI + 1) % wallPoints.Count] - wallPoints[deltaPointI]; * * Vec2i newPoint2 = new Vec2i(newPoint.x, newPoint.z); * if (np1_to_n.x == 0) * { * newPoint2.x = wallPoints[(deltaPointI + 1) % wallPoints.Count].x; * } * else * { * newPoint2.z = wallPoints[(deltaPointI + 1) % wallPoints.Count].z; * } * wallPoints.Insert((deltaPointI + 1), newPoint); * wallPoints.Insert((deltaPointI + 2), newPoint2); * * smith.BoundingWall = wallPoints.ToArray(); */ }