Exemplo n.º 1
0
 public void Unexecute()
 {
     movInfo.endPosition.Vacate();
     movInfo.fromTile.OcupyTile(movInfo.moveOccupy);
     PositionerDemo.Position pos = new PositionerDemo.Position(movInfo.fromTile.position.posX, movInfo.fromTile.position.posY);
     game.board2DManager.AddModifyOccupierPosition(movInfo.moveOccupy, pos);
 }
Exemplo n.º 2
0
        public void Execute()
        {
            // Kimboko aCombinar

            // Kimboko combinador
            // TENEMOS QUE ELIMINAR LA UNIDAD ACTUAL DE LA LISTA DE UNIDADES DEL PLAYER
            spawnInfo.spawnerPlayer.RemoveUnit(combiner);
            // DEBERIAMOS DESOCUPAR LA TILE DONDE ESTA EL KIMBOKO ACTUAL YA QUE VA A PASAR A SER UNO NUEVO
            spawnInfo.spawnTile.Vacate();
            // DEBERIAMOS DESOCUPAR EL BOARD MANAGER ACTUAL
            game.board2DManager.RemoveOccupierPosition(combiner);

            // Kimboko combinado
            // CREAMOS EL KIMBOKO COMBINADO CON SUS NUEVOS STATS
            CombineAbilityEventInfo cmbInfo = new CombineAbilityEventInfo(combiner, spawnedKimboko, spawnInfo.spawnerPlayer, spawnInfo.spawnIndexID);

            finalCombinedKimboko = GetCombinedKimboko(cmbInfo);

            // DEBEMOS OCUPAR LA TILE CON LA NUEVA UNIDAD COMBINADA
            spawnInfo.spawnTile.OcupyTile(finalCombinedKimboko);
            // DEBEMOS AGREGARLE AL PLAYER EL NUEVO KIMBOKO COMBINADO
            spawnInfo.spawnerPlayer.AddUnit(finalCombinedKimboko);
            // DEBEMOS AGREGARLE AL BOARD MANAGER LA NUEVA UNIDAD COMBINADA
            PositionerDemo.Position pos = new PositionerDemo.Position(spawnInfo.spawnTile.position.posX, spawnInfo.spawnTile.position.posY);
            game.board2DManager.AddModifyOccupierPosition(finalCombinedKimboko, pos);
            finalCombinedKimboko.SetPosition(pos);

            executionState = COMMANDEXECUTINSTATE.FINISH;
        }
Exemplo n.º 3
0
        public void Execute()
        {
            kimboko = GetNewKimboko(spawnInfo);
            kimboko.SetGoAnimContainer(new GameObjectAnimatorContainer(kimbokoGO, kimbokoGO.GetComponent <Animator>()));
            spawnInfo.spawnTile.OcupyTile(kimboko);
            spawnInfo.spawnerPlayer.AddUnit(kimboko);

            PositionerDemo.Position pos = new PositionerDemo.Position(spawnInfo.spawnTile.position.posX, spawnInfo.spawnTile.position.posY);
            game.board2DManager.AddModifyOccupierPosition(kimboko, pos);
            kimboko.SetPosition(pos);
            executionState = COMMANDEXECUTINSTATE.FINISH;
        }
Exemplo n.º 4
0
        public void Unexecute()
        {
            spawnInfo.spawnTile.Vacate();
            spawnInfo.spawnerPlayer.RemoveUnit(finalCombinedKimboko);
            finalCombinedKimboko.goAnimContainer.DestroyPrefab();
            game.board2DManager.RemoveOccupierPosition(finalCombinedKimboko);
            spawnedKimboko.goAnimContainer.DestroyPrefab();


            spawnInfo.spawnTile.OcupyTile(combiner);
            spawnInfo.spawnerPlayer.AddUnit(combiner);
            PositionerDemo.Position pos = new PositionerDemo.Position(spawnInfo.spawnTile.position.posX, spawnInfo.spawnTile.position.posY);
            game.board2DManager.AddModifyOccupierPosition(combiner, pos);
            combiner.SetPosition(pos);
        }
Exemplo n.º 5
0
        public void Unexecute()
        {
            combineTile.Vacate();
            combInfo.player.RemoveUnit(finalCombinedKimboko);
            finalCombinedKimboko.goAnimContainer.DestroyPrefab();
            game.board2DManager.RemoveOccupierPosition(finalCombinedKimboko);

            combineTile.OcupyTile(combInfo.combiner);
            combInfo.player.AddUnit(combInfo.combiner);
            PositionerDemo.Position pos = new PositionerDemo.Position(combineTile.position.posX, combineTile.position.posY);
            game.board2DManager.AddModifyOccupierPosition(combInfo.combiner, pos);
            combInfo.combiner.SetPosition(pos);

            fromTile.OcupyTile(combInfo.kimbokoToCombine);;
            combInfo.player.AddUnit(combInfo.kimbokoToCombine);
            PositionerDemo.Position fromPos = new PositionerDemo.Position(fromTile.position.posX, fromTile.position.posY);
            game.board2DManager.AddModifyOccupierPosition(combInfo.kimbokoToCombine, fromPos);
            combInfo.kimbokoToCombine.SetPosition(fromPos);
        }
Exemplo n.º 6
0
        public void Execute()
        {
            // Kimboko aCombinar
            // TENEMOS QUE ELIMINAR LA UNIDAD ACTUAL DE LA LISTA DE UNIDADES DEL PLAYER QUE SE VA A COMBINAR
            combInfo.player.RemoveUnit(combInfo.kimbokoToCombine);

            // TENEMOS QUE SACARLO DE SU TILE Y DESOCUPARLA
            fromTile = game.board2DManager.GetUnitPosition(combInfo.kimbokoToCombine);
            fromTile.Vacate();
            game.board2DManager.RemoveOccupierPosition(combInfo.kimbokoToCombine);

            // Kimboko combinador
            // TENEMOS QUE ELIMINAR LA UNIDAD ACTUAL DE LA LISTA DE UNIDADES DEL PLAYER
            combInfo.player.RemoveUnit(combInfo.combiner);

            // DEBERIAMOS DESOCUPAR LA TILE DONDE ESTA EL KIMBOKO ACTUAL YA QUE VA A PASAR A SER UNO NUEVO
            // DONDE VOY A COMBINAR
            combineTile = game.board2DManager.GetUnitPosition(combInfo.combiner);
            combineTile.Vacate();

            // DEBERIAMOS DESOCUPAR EL BOARD MANAGER ACTUAL
            game.board2DManager.RemoveOccupierPosition(combInfo.combiner);

            // Kimboko combinado
            // CREAMOS EL KIMBOKO COMBINADO CON SUS NUEVOS STATS
            finalCombinedKimboko = GetCombinedKimboko(combInfo);

            // DEBEMOS OCUPAR LA TILE CON LA NUEVA UNIDAD COMBINADA
            combineTile.OcupyTile(finalCombinedKimboko);
            // DEBEMOS AGREGARLE AL PLAYER EL NUEVO KIMBOKO COMBINADO
            combInfo.player.AddUnit(finalCombinedKimboko);
            // DEBEMOS AGREGARLE AL BOARD MANAGER LA NUEVA UNIDAD COMBINADA
            PositionerDemo.Position pos = new PositionerDemo.Position(combineTile.position.posX, combineTile.position.posY);
            game.board2DManager.AddModifyOccupierPosition(finalCombinedKimboko, pos);
            finalCombinedKimboko.SetPosition(pos);

            executionState = COMMANDEXECUTINSTATE.FINISH;
        }
    public List <Tile> FiltterMoveables(Tile from, MOVEDIRECTIONTYPE moveDirectionType, Tile[,] boardTiles, int movementAmount)
    {
        if (from == null)
        {
            return(null);
        }
        if (movementAmount == 0)
        {
            return(null);
        }

        List <Tile> moveableTiles = new List <Tile>();

        PositionerDemo.Position fromPosition = new PositionerDemo.Position(from.position.posX, from.position.posY);

        int maxX = boardTiles.GetLength(0);
        int maxY = boardTiles.GetLength(1);

        for (int i = 1; i <= movementAmount; i++)
        {
            // UP RIGHT
            if (blockDirection)
            {
                if (!blockUpRight)
                {
                    if (fromPosition.posY + i < maxY && fromPosition.posX + i < maxX)
                    {
                        if (!boardTiles[fromPosition.posX + i, fromPosition.posY + i].IsOccupied())
                        {
                            moveableTiles.Add(boardTiles[fromPosition.posX + i, fromPosition.posY + i]);
                        }
                        else
                        {
                            blockUpRight = true;
                        }
                    }
                }
            }
            else
            {
                if (fromPosition.posY + i < maxY && fromPosition.posX + i < maxX)
                {
                    if (!boardTiles[fromPosition.posX + i, fromPosition.posY + i].IsOccupied())
                    {
                        moveableTiles.Add(boardTiles[fromPosition.posX + i, fromPosition.posY + i]);
                    }
                }
            }

            // UP LEFT
            if (blockDirection)
            {
                if (!blockUpLeft)
                {
                    if (fromPosition.posY + i < maxY && fromPosition.posX - i >= 0)
                    {
                        if (!boardTiles[fromPosition.posX - i, fromPosition.posY + i].IsOccupied())
                        {
                            moveableTiles.Add(boardTiles[fromPosition.posX - i, fromPosition.posY + i]);
                        }
                        else
                        {
                            blockUpLeft = true;
                        }
                    }
                }
            }
            else
            {
                if (fromPosition.posY + i < maxY && fromPosition.posX - i >= 0)
                {
                    if (!boardTiles[fromPosition.posX - i, fromPosition.posY + i].IsOccupied())
                    {
                        moveableTiles.Add(boardTiles[fromPosition.posX - i, fromPosition.posY + i]);
                    }
                }
            }

            // DOWN RIGHT
            if (blockDirection)
            {
                if (!blockDownRight)
                {
                    if (fromPosition.posY - i >= 0 && fromPosition.posX + i < maxX)
                    {
                        if (!boardTiles[fromPosition.posX + i, fromPosition.posY - i].IsOccupied())
                        {
                            moveableTiles.Add(boardTiles[fromPosition.posX + i, fromPosition.posY - i]);
                        }
                        else
                        {
                            blockDownRight = true;
                        }
                    }
                }
            }
            else
            {
                if (fromPosition.posY - i >= 0 && fromPosition.posX + i < maxX)
                {
                    if (!boardTiles[fromPosition.posX + i, fromPosition.posY - i].IsOccupied())
                    {
                        moveableTiles.Add(boardTiles[fromPosition.posX + i, fromPosition.posY - i]);
                    }
                }
            }

            // DOWN LEFT
            if (blockDirection)
            {
                if (!blockDownLeft)
                {
                    if (fromPosition.posY - i >= 0 && fromPosition.posX - i >= 0)
                    {
                        if (!boardTiles[fromPosition.posX - i, fromPosition.posY - i].IsOccupied())
                        {
                            moveableTiles.Add(boardTiles[fromPosition.posX - i, fromPosition.posY - i]);
                        }
                        else
                        {
                            blockDownLeft = true;
                        }
                    }
                }
            }
            else
            {
                if (fromPosition.posY - i >= 0 && fromPosition.posX - i >= 0)
                {
                    if (!boardTiles[fromPosition.posX - i, fromPosition.posY - i].IsOccupied())
                    {
                        moveableTiles.Add(boardTiles[fromPosition.posX - i, fromPosition.posY - i]);
                    }
                }
            }
        }
        return(moveableTiles);
    }
Exemplo n.º 8
0
    public List <Tile> FiltterMoveables(Tile from, MOVEDIRECTIONTYPE moveDirectionType, Tile[,] boardTiles, int movementAmount)
    {
        if (from == null)
        {
            return(null);
        }
        if (movementAmount == 0)
        {
            return(null);
        }

        List <Tile> moveableTiles = new List <Tile>();

        PositionerDemo.Position fromPosition = new PositionerDemo.Position(from.position.posX, from.position.posY);

        int maxX = boardTiles.GetLength(0);
        int maxY = boardTiles.GetLength(1);

        //            GridArray = new Tile[this.columnsWidht, this.rowsHeight];
        //              this.columnsWidht = columnsWidht + 4;   11 columnas
        //           this.rowsHeight = rowsHeight;    5 filas
        //
        // maxX = 11;   x + 1 == right  x - 1 == left
        // maxY = 5;     y + 1 == up   y - 1 == down

        for (int i = 1; i <= movementAmount; i++)
        {
            if (moveDirectionType == MOVEDIRECTIONTYPE.CROSSRIGHT)
            {
                if (blockDirection)
                {
                    if (!blockRight)
                    {
                        if (fromPosition.posX + i < maxX)
                        {
                            if (!boardTiles[fromPosition.posX + i, fromPosition.posY].IsOccupied())
                            {
                                moveableTiles.Add(boardTiles[fromPosition.posX + i, fromPosition.posY]);
                            }
                            else
                            {
                                blockRight = true;
                            }
                        }
                    }
                }
                else
                {
                    if (fromPosition.posX + i < maxX)
                    {
                        if (!boardTiles[fromPosition.posX + i, fromPosition.posY].IsOccupied())
                        {
                            moveableTiles.Add(boardTiles[fromPosition.posX + i, fromPosition.posY]);
                        }
                    }
                }
            }
            else if (moveDirectionType == MOVEDIRECTIONTYPE.CROSSLEFT)
            {
                if (blockDirection)
                {
                    if (!blockLeft)
                    {
                        if (fromPosition.posX - i >= 0)
                        {
                            if (!boardTiles[fromPosition.posX - i, fromPosition.posY].IsOccupied())
                            {
                                moveableTiles.Add(boardTiles[fromPosition.posX - i, fromPosition.posY]);
                            }
                            else
                            {
                                blockLeft = true;
                            }
                        }
                    }
                }
                else
                {
                    if (fromPosition.posX - i >= 0)
                    {
                        if (!boardTiles[fromPosition.posX - i, fromPosition.posY].IsOccupied())
                        {
                            moveableTiles.Add(boardTiles[fromPosition.posX - i, fromPosition.posY]);
                        }
                    }
                }
            }
            // UP
            if (blockDirection)
            {
                if (!blockUp)
                {
                    if (fromPosition.posY + i < maxY)
                    {
                        if (!boardTiles[fromPosition.posX, fromPosition.posY + i].IsOccupied())
                        {
                            moveableTiles.Add(boardTiles[fromPosition.posX, fromPosition.posY + i]);
                        }
                        else
                        {
                            blockUp = true;
                        }
                    }
                }
            }
            else
            {
                if (fromPosition.posY + i < maxY)
                {
                    if (!boardTiles[fromPosition.posX, fromPosition.posY + i].IsOccupied())
                    {
                        moveableTiles.Add(boardTiles[fromPosition.posX, fromPosition.posY + i]);
                    }
                }
            }

            // DOWN
            if (blockDirection)
            {
                if (!blockDown)
                {
                    if (fromPosition.posY - i >= 0)
                    {
                        if (!boardTiles[fromPosition.posX, fromPosition.posY - i].IsOccupied())
                        {
                            moveableTiles.Add(boardTiles[fromPosition.posX, fromPosition.posY - i]);
                        }
                        else
                        {
                            blockDown = true;
                        }
                    }
                }
            }
            else
            {
                if (fromPosition.posY - i >= 0)
                {
                    if (!boardTiles[fromPosition.posX, fromPosition.posY - i].IsOccupied())
                    {
                        moveableTiles.Add(boardTiles[fromPosition.posX, fromPosition.posY - i]);
                    }
                }
            }
        }
        return(moveableTiles);
    }