private BaseNexoTile CreateBaseNexoTile(Player player) { BaseNexoTile baseNexoTile = null; Vector2 position = board2DManager.GetPlayerNexusWorldPosition(player); switch (player.OwnerPlayerID) { case 0: baseNexoTile = new BaseNexoTile(position, 0, 0, player); board2DManager.AddModifyOccupierPosition(player, new Position(0, 0)); board2DManagerUI.CreateBaseNexoTile(baseNexoTile, true); break; case 1: baseNexoTile = new BaseNexoTile(position, 9, 0, player); board2DManager.AddModifyOccupierPosition(player, new Position(9, 0)); board2DManagerUI.CreateBaseNexoTile(baseNexoTile, false); break; default: break; } return(baseNexoTile); }
public void CreateBaseNexoTile(BaseNexoTile baseNexoTile, bool isPlayerOne) { Vector2 position = Vector2.zero; if (isPlayerOne) { position = new Vector2(posInitXJug1, 0 + newUpYOffset); } else { position = new Vector2(posInitXJug2, 0 + newUpYOffset); } GameObject goAuxTile = Instantiate(playerTilePrefab, position, Quaternion.identity); baseNexoTile.SetGoAnimContainer(new GameObjectAnimatorContainer(goAuxTile, goAuxTile.GetComponent <Animator>())); }
public void CreateBoard(Player[] players) { BaseNexoTile[] nexoTiles = new BaseNexoTile[2]; for (int i = 0; i < players.Length; i++) { // nexo = posx, posy, grid Player nexoTiles[i] = CreateBaseNexoTile(players[i]); } for (int x = 0; x < GridArray.GetLength(0); x++) { for (int y = 0; y < GridArray.GetLength(1); y++) { // todas las posiciones de las columnas 0 / 1 van a estar ocupadas por la misma tile del player 1 if (x == 0 || x == 1) { GridArray[x, y] = nexoTiles[0]; continue; } // todas las posiciones de las columnas 9 / 10 van a estar ocupadas por la misma tile del player 2 if (x == 9 || x == 10) { GridArray[x, y] = nexoTiles[1]; continue; } // todas las posiciones de la columna 2 van a estar ocupadas por la spawn tile del player 1 if (x == 2) { // spawn = posx, posy, grid playerID CreateSpawnTile(x, y, players[0]); } // todas las posiciones de la columna 8 van a estar ocupadas por la spawn tile del player 2 else if (x == _columns - 3) { // spawn = posx, posy, grid playerID CreateSpawnTile(x, y, players[1]); } else { // battlefield posx, posy, grid CreateBattlefiledTile(x, y); } } } for (int x = 0; x < _columns; x++) { for (int y = 0; y < _rows; y++) { if (x == 0 || x == 1) { continue; } if (x == 9 || x == 10) { continue; } SetNeighborsTiles(GridArray[x, y]); } } }