Пример #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(int column, int row, Gameboard gameboard)
 {
     if (column < Variables.columns || row < Variables.rows)
     {
         Cell cell = gameboard.getCell(row, column);
         removeArrow(cell, gameboard);
     }
 }
Пример #4
0
        public void directionTileCheck(Gameboard gameboard)
        {
            if (getSpriteCenter().X >= getCurrentColumn(gameboard) * Variables.cellWidth + Variables.cellWidth / 2.5
                && getSpriteCenter().X <= (getCurrentColumn(gameboard) + 1) * Variables.cellWidth - Variables.cellWidth / 2.5
                && getSpriteCenter().Y >= getCurrentRow(gameboard) * Variables.cellHeigth + Variables.cellHeigth / 2.5
                && getSpriteCenter().Y <= (getCurrentRow(gameboard) + 1) * Variables.cellHeigth - Variables.cellHeigth / 2.5)
            {

                int tileID = gameboard.getCell(this.getCurrentRow(gameboard), this.getCurrentColumn(gameboard)).getTileID();

                switch (tileID)
                {
                    case 1:
                        direction = Variables.Direction.Up;
                        break;
                    case 2:
                        direction = Variables.Direction.Right;
                        break;
                    case 3:
                        direction = Variables.Direction.Down;
                        break;
                    case 4:
                        direction = Variables.Direction.Left;
                        break;
                    default: break;
                }
            }
        }