コード例 #1
0
            //Constructs a board space on top of a provided node argument, obtained from the nodegrid
            //as well as a boardpiece, if placing boardpieces is required at instantiation
            public BoardSpace(BoardNode nodeArg, BoardPiece pieceArg)
            {
                mBoardNode = nodeArg;

                PieceAt           = pieceArg;
                mPiecePresentBool = true;
            }
コード例 #2
0
        public List <BoardPiece> ReturnPossibleTargets(Unit attackingUnitArg)
        {
            List <BoardPiece> targetPieces = new List <BoardPiece>();

            Board.BoardSpace     startLocation = mBoardOfPlay.GetBoardSpaceOfToken(attackingUnitArg);
            Board                testB         = mBoardOfPlay;
            NodeGrid             testG         = testB.NodeGrid;
            List <SpaceMovement> allDir        = testG.ALL_DIRECTIONS;

            foreach (SpaceMovement iDir in allDir)
            {
                Board.BoardSpace spaceWalker = startLocation;
                for (int i = 0; i < attackingUnitArg.AttackRange + 1; i++)
                {
                    spaceWalker = mBoardOfPlay.SpaceAtMove(spaceWalker.GetCoords(), iDir);
                    BoardPiece lPiece = spaceWalker.PieceAt;
                    bool       test1  = lPiece != null;
                    if (test1)
                    {
                        bool test2 = lPiece.Token.TokenID.IDChar != attackingUnitArg.TokenID.IDChar;
                    }


                    if (lPiece != null && lPiece.Token.TokenID.IDChar != attackingUnitArg.TokenID.IDChar)
                    {
                        if (lPiece.Targetable)
                        {
                            targetPieces.Add(spaceWalker.PieceAt);
                        }
                    }
                }
            }
            return(targetPieces);
        }
コード例 #3
0
 //Updates an empty board space to a new unit token
 public void SetNewPieceValue(BoardPiece mPieceArg)
 {
     if (!this.hasPiece)
     {
         mPiece            = mPieceArg;
         mPiecePresentBool = true;
     }
 }
コード例 #4
0
 //Place a board piece at a coordinate, straightforward
 public void SetBoardPieceAt(BoardPiece pieceArg, SpaceCoordinate coordArg)
 {
     GetBoardSpace(coordArg).SetNewPieceValue(pieceArg);
 }
コード例 #5
0
        //Places a unit at a coordinate
        public void PlaceUnit(Unit unitArg, SpaceCoordinate coordArg)
        {
            BoardPiece placedPiece = new BoardPiece(unitArg);

            mBoardOfPlay.SetBoardPieceAt(placedPiece, coordArg);
        }