public CardTargetManager(Board2DManager board2D) { boardTiles = new List <Tile>(); // RECORREMOS LA LISTA DE TILES for (int x = 0; x < board2D.GridArray.GetLength(0); x++) { for (int y = 0; y < board2D.GridArray.GetLength(1); y++) { Tile actualTile = board2D.GetGridObject(x, y); boardTiles.Add(actualTile); } } }
public Motion CreateNewBoardMotion(Board2DManager board2D, Action OnBoardLoadComplete) { GameObject[,] tiles = new GameObject[board2D.columnsWidht, board2D.rowsHeight]; int index = 1; GameObject tileParent = new GameObject("TileParent"); List <Motion> motionsCreateBoard = new List <Motion>(); for (int x = 0; x < board2D.columnsWidht; x++) { for (int y = 0; y < board2D.rowsHeight; y++) { if (x == 0 || x == 1) { tiles[x, y] = board2D.GridArray[x, y].goAnimContainer.GetTransform().gameObject; tiles[x, y].transform.SetParent(tileParent.transform); continue; } if (x == 9 || x == 10) { tiles[x, y] = board2D.GridArray[x, y].goAnimContainer.GetTransform().gameObject; tiles[x, y].transform.SetParent(tileParent.transform); continue; } Vector3 thisTileFinalPosition = board2D.GetGridObject(x, y).GetRealWorldLocation(); tiles[x, y] = board2D.GridArray[x, y].goAnimContainer.GetTransform().gameObject; tiles[x, y].transform.position = new Vector3(thisTileFinalPosition.x, Helper.GetCameraTopBorderYWorldPostion().y, 0); tiles[x, y].transform.SetParent(tileParent.transform); // TWEEN DE LA CRANE A LA POSICION DE SPAWNEO Motion motionTweenMove = new MoveTweenMotion(this, tiles[x, y].transform, index, thisTileFinalPosition, 1); motionsCreateBoard.Add(motionTweenMove); } index++; } // para las spawn tiles Vector2 yOffset = new Vector2(0, 10); Vector3 pOneNexusFinalPosition = board2D.GetPlayerNexusWorldPosition(true); tiles[0, 0].transform.position = new Vector3(pOneNexusFinalPosition.x, Helper.GetCameraTopBorderYWorldPostion().y + yOffset.y, 0); Motion motionTweenNexusP1Move = new MoveTweenMotion(this, tiles[0, 0].transform, index, pOneNexusFinalPosition, 1); motionsCreateBoard.Add(motionTweenNexusP1Move); Vector3 pTwoNexusFinalPosition = board2D.GetPlayerNexusWorldPosition(false); tiles[9, 0].transform.position = new Vector3(pTwoNexusFinalPosition.x, Helper.GetCameraTopBorderYWorldPostion().y + yOffset.y, 0); Motion motionTweenNexusP2Move = new MoveTweenMotion(this, tiles[9, 0].transform, index, pTwoNexusFinalPosition, 1); motionsCreateBoard.Add(motionTweenNexusP2Move); index++; List <Configurable> configurables = new List <Configurable>(); EventInvokerGenericContainer evenToInvoke = new EventInvokerGenericContainer(OnBoardLoadComplete); InvokeEventConfigureAnimotion <EventInvokerGenericContainer, Transform> onBoardCompleteInvokeEvent = new InvokeEventConfigureAnimotion <EventInvokerGenericContainer, Transform>(evenToInvoke, index); configurables.Add(onBoardCompleteInvokeEvent); CombineMotion combinMoveMotion = new CombineMotion(this, 1, motionsCreateBoard, configurables); return(combinMoveMotion); }