public void SpaceSelect(GameObject selectedObject) { //Disable board spaces Coordinates currentLocation = CurrentPlayer.SelectedPiece.CurrentLocation; BoardSpace currentBoardSpace = Board.Spaces[currentLocation.Section][currentLocation.Row][currentLocation.Position]; foreach (var adjacentSpace in currentBoardSpace.AdjacentSpaces) { GameObject target = GameObject.Find("Space." + adjacentSpace.Section + "." + adjacentSpace.Row + "." + adjacentSpace.Position); target.GetComponent <PolygonCollider2D>().enabled = false; } //Move selectedPiece to new location GameObject currentPiece = GameObject.Find(CurrentPlayer.TeamColor + CurrentPlayer.GetPieceNumber()); currentPiece.gameObject.transform.localPosition = selectedObject.transform.localPosition; //Disable selectedPiece for remainder of turn currentPiece.GetComponent <CircleCollider2D>().enabled = false; //Update GameBoard //Naming convention for spaces is "Space.X.Y.Z" Coordinates newLocation = new Coordinates( (int)char.GetNumericValue(selectedObject.name[6]), (int)char.GetNumericValue(selectedObject.name[8]), (int)char.GetNumericValue(selectedObject.name[10]) ); CurrentPlayer.SelectedPiece.Move(newLocation); //Deposit on-board Gold if the new location is at the center of the map if (newLocation.Row == 0) { AddPlayerGold(); } //Check for Asteroid in new location BoardSpace newBoardSpace = Board.Spaces[newLocation.Section][newLocation.Row][newLocation.Position]; Asteroid foundAsteroid = newBoardSpace.asteroid; int goldCollected = 0; if (foundAsteroid != null) { GameObject asteroidUI = GameObject.Find("Ast" + foundAsteroid.Number); GameObject header = GameObject.Find("SelectionHeader"); header.GetComponent <TextMeshProUGUI>().SetText("Asteroid " + foundAsteroid.Number); //If Asteroid is newly Discovered or captured from other player, claim it if (foundAsteroid.ControllingPlayer != CurrentPlayer.Team) { asteroidUI.gameObject.transform.localPosition = selectedObject.transform.localPosition; asteroidUI.GetComponent <MeshRenderer>().enabled = true; foundAsteroid.ControllingPlayer = CurrentPlayer.Team; CurrentPlayer.ClaimAsteroid(foundAsteroid); GameObject details = GameObject.Find("SelectionDetails"); details.GetComponent <TextMeshProUGUI>().SetText("Claimed by " + CurrentPlayer.TeamColor + "\n" + "Gold remaining:\n " + foundAsteroid.GetRemainingGold()); } //Otherwise already controlled by player, collect accumlated gold else { goldCollected = foundAsteroid.TakeGold(); CurrentPlayer.SelectedPiece.CollectGold(goldCollected); GameObject details = GameObject.Find("SelectionDetails"); details.GetComponent <TextMeshProUGUI>().SetText("Gold collected:\n " + goldCollected + "\n" + "Gold remaining:\n " + foundAsteroid.GetRemainingGold()); } } UpdatePlayerTurn(); }