public void moveBlock(int newPos) { Vector3 nextPosition = Board.spaces[this.currentPosition].getPosition(); List <string> startingSpace = Board.spaces[this.currentPosition].getCamelOnSpaces(); int camelStackPos = startingSpace.IndexOf(this.id + "_camel"); List <string> blockToMove = startingSpace.GetRange(camelStackPos, startingSpace.Count - camelStackPos); Board.spaces[this.currentPosition].removeRange(camelStackPos, startingSpace.Count - camelStackPos); foreach (string s in blockToMove) { Board.addCamel(s, newPos); } Camel.stackCamels(); }
public static void setUpBoard() { int count = 0; //set up count for (int i = 4; i <= 12; i += 4) { spaces [count] = new BoardSpace((new Vector3(i, 0.5f, 3)), count); count++; } for (int i = -1; i >= -13; i += -4) { spaces [count] = new BoardSpace((new Vector3(12, 0.5f, i)), count); count++; } for (int i = 8; i >= -4; i -= 4) { spaces [count] = new BoardSpace((new Vector3(i, 0.5f, -13)), count); count++; } for (int i = -9; i <= 3; i += 4) { spaces [count] = new BoardSpace(new Vector3(-4, 0.5f, i), count); count++; } spaces [15] = new BoardSpace(new Vector3(0, 0.5f, 3), count); List <string> camels = new List <string> { "green_camel", "yellow_camel", "orange_camel", "white_camel", "blue_camel" }; for (int i = 0; i < 5; i++) { int index = Random.Range(0, camels.Count); addCamel(camels [index], Random.Range(0, 2)); camels.Remove(camels [index]); } Camel.stackCamels(); }