Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private bool GetNext(DIRECTION direction, TransportCell currentCell ) {
- bool Done = false;
- if (direction == DIRECTION.ROW) {
- for (int j = 0; j < consumerCount; j++) {
- if (j == currentCell.Col) { continue; }
- else if (j == start.Col && currentCell.Row == start.Row) { return true; }
- else if (!TaskMatrix[currentCell.Row, j].Cargo.IsNull) {
- Done = GetNext(DIRECTION.COLUMN, TaskMatrix[currentCell.Row, j]);
- if (Done) { Cycle.Add(this.TaskMatrix[currentCell.Row, j]); return true; }
- }
- }
- }
- else {
- for (int i = 0; i < providerCount; i++) {
- if (i == currentCell.Row) { continue; }
- else if (i == start.Row && currentCell.Col == start.Col) { return true; }
- else if (!TaskMatrix[i, currentCell.Col].Cargo.IsNull) {
- Done = GetNext(DIRECTION.ROW, TaskMatrix[i, currentCell.Col]);
- if (Done) {
- Cycle.Add(this.TaskMatrix[i, currentCell.Col]);
- return true;
- }
- }
- }
- }
- return false;
- }
Add Comment
Please, Sign In to add comment