Пример #1
0
        public void addArrow(int column, int row, Variables.Direction dir, Gameboard gameboard, int dirtex)
        {
            if (column < Variables.columns || row < Variables.rows)
            {
                Cell cell = gameboard.getCell(row, column);
                if (!cell.isBase && !cell.isSpawn)
                {
                    if (!hasArrow(cell) && rdy)
                    {
                        if (p_arrows.Count >= MAX_ARROWS)
                        {
                            Cell c = p_arrows[p_arrows.Count - 1];
                            removeArrow(c, gameboard);
                        }

                        p_arrows.Insert(0, cell);
                        cell.setOwnedBy(index);
                        gameboard.updateTile(column, row, dir, arrows[dirtex - 1]);
                    }
                    else
                    {
                        removeArrow(cell, gameboard);
                        p_arrows.Insert(0, cell);
                        cell.setOwnedBy(index);
                        gameboard.updateTile(column, row, dir, arrows[dirtex - 1]);
                    }
                }
            }
        }
Пример #2
0
        //FOLLOWING SECTION IS TO BE REMOVED, IT IS THE PLAYER 1 MOUSE DEBUG TOOL FOR DEVELOPER WITHOUT XBOX CONTROLLER
        //*************************************************************************************************************
        public void addArrow(Vector2 position, Variables.Direction dir, Gameboard gameboard, int dirtex)
        {
            int tempCol = (int)position.X / Variables.cellWidth;
            int tempRow = (int)position.Y / Variables.cellHeigth;
            Cell temp_c = gameboard.getCell(tempRow, tempCol);

            if (!hasArrow(temp_c) && rdy)
            {

                if (p_arrows.Count >= 4)
                {
                    Cell c = p_arrows[p_arrows.Count - 1];
                    int c_column = c.getPositionY();
                    int c_row = c.getPositionX();

                    gameboard.updateTile(c_column, c_row, Variables.Direction.None, Tile.cellBorder);

                    p_arrows.Remove(c);
                }

                p_arrows.Insert(0, temp_c);
                gameboard.updateTile(position, dir, arrows[dirtex - 1]);
            }
        }
Пример #3
0
 public void removeArrow(Cell cell, Gameboard gameboard)
 {
     if(p_arrows.Contains(cell))
     {
         gameboard.updateTile(cell.getPositionY(), cell.getPositionX(), Variables.Direction.None, Tile.cellBorder);
         p_arrows.Remove(cell);
         cell.setOwnedBy(0);
     }
 }