Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void BuildRecursively(IntCoordinates c) {
- MECCoroutineQueue instance = MECCoroutineQueue.Instance;
- Queue<IntCoordinates> ToBeChecked = new Queue<IntCoordinates> ();
- ToBeChecked.Enqueue (c);
- while (ToBeChecked.Count != 0) {
- IntCoordinates home = ToBeChecked.Dequeue ();
- //function to check whether a provided coordinate set needs to be built
- Func<IntCoordinates, bool> Unbuilt = (o) => !generator.chunks.ContainsKey (o);
- Func<IntCoordinates, bool> CloseEnough = (o) => CheckRadius (o);
- //list of all coordinates for which we will be building
- int step = MakeChunk_5.Step;
- IntCoordinates[] coords = new IntCoordinates[] {
- home + new IntCoordinates (-step, 0, 0),
- home + new IntCoordinates (+step, 0, 0),
- home + new IntCoordinates (0, -step, 0),
- home + new IntCoordinates (0, +step, 0),
- home + new IntCoordinates (0, 0, -step),
- home + new IntCoordinates (0, 0, +step)
- };
- //for each coordinate set in the list, check to see if it should be built, and if so, build it
- for (int i = 0; i < coords.Length; i++) {
- if (CloseEnough (coords [i])) {
- if (!worked.Contains (coords [i])) {
- worked.Add (coords [i]);
- ToBeChecked.Enqueue (coords [i]);
- }
- if (Unbuilt (coords [i])) {
- instance.Run (chunkMaker.Make (coords [i]));
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement