public void DisplayLegalMoves(int numSpaces) { // displays all legal moves on the board GameData.SetGameMode(GameData.Mode.SelectMove); // get legal moves List <Move> moves = GetLegalMoves(numSpaces); //keep track of piece that is associated with each color Dictionary <Character, int> colorMap = new Dictionary <Character, int>(); //assign colors to each piece int piecesCount = 0; foreach (Move move in moves) { if (!colorMap.ContainsKey(move.GetPiece())) { colorMap.Add(move.GetPiece(), piecesCount); piecesCount++; } } // display them foreach (Move move in moves) { // draw line from start to end tile GameObject lineObject = Instantiate(GameData.GetPrefabAssetHolder().GetLine()); Line line = lineObject.GetComponent <Line>(); Debug.Log(line); Debug.Log(move.GetPiece().GetCurrTile().GetPosition()); Debug.Log(move.GetDestTile().GetPosition()); Debug.Log(colors[colorMap[move.GetPiece()]]); line.SetStartAndEnd(move.GetPiece().GetCurrTile().GetPosition(), move.GetDestTile().GetPosition(), colors[colorMap[move.GetPiece()]]); lines.Push(line); // store move in line line.SetMove(move); // highlight destination tile Tile destTile = move.GetDestTile(); destTile.GetComponent <Outline>().enabled = true; destTiles.Push(destTile); } var allLines = FindObjectsOfType <Line>(); foreach (Line line in allLines) { line.SetOtherLines(); } // show the select move GUI GameGUI.ShowSelectMoveScreen(moves.Count > 0); }