public PieceView CreatePieceView(Board <Piece> board, Piece modal) { var index = _movementNames.IndexOf(modal.MovementName); var prefab = _players[index]; var gameObject = Instantiate(prefab); var pieceView = gameObject.GetComponentInChildren <PieceView>(); var tile = board.TileOf(modal); gameObject.transform.position = BoardPositionHelper.BoardToWorldPosition(tile.Position); gameObject.name = $"Spauwned piece ( { modal.MovementName } )"; pieceView.Modal = modal; return(pieceView); }
public void PlaceRandomEnemies() { var spots = new List <CubicHexCoord>() { new CubicHexCoord() }; var board = BoardPositionHelper.GenerateBoard(_boardSize); while (spots.Count <= _enemyAmount) { var go = Instantiate(_enemyPrefab); CubicHexCoord spot = GetRandomSpot(board); while (spots.Contains(spot)) { spot = GetRandomSpot(board); } go.transform.position = BoardPositionHelper.BoardToWorldPosition(spot); spots.Add(spot); } }