コード例 #1
0
ファイル: Player.cs プロジェクト: evwhite1988/INF-125-Project
        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
ファイル: Player.cs プロジェクト: evwhite1988/INF-125-Project
        //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
ファイル: Player.cs プロジェクト: evwhite1988/INF-125-Project
 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);
     }
 }