Example #1
0
	private void AddResponse(InputResponder responder, Gameplay.Move_Billy move)
	{
		responder.OnStopClick += (_responder, mousePos) =>
		{
			//Apply the move.
			var results = new Gameplay.MovementResults(Board, move);
			Board.MoveElement(false, move.Piece.Pos, move.NewPos);
			Board.Apply(results, Gameplay.Teams.Friendly);

			//Stop the piece from being movable again.
			activePiece.ActiveSpriteObj.GetComponent<SpriteRenderer>().color = MovedColor;
			Destroy(activePiece.GetComponent<InputResponder>());
			SpritePool.Instance.DeallocateSprites(moveSprites);
			moveOptions.Clear();

			Logic.MovesLeftThisTurn -= 1;
		};
	}
Example #2
0
        public bool DidCurseWin(Board board)
        {
            //The curse wins if there are no empty spaces to place new pieces,
            //    and any existing friendly pieces have no movement options.
            List <Move_Billy> friendlyMoves = new List <Move_Billy>();

            return(board.AllPoses.Enumerable().All(pos => board.Pieces.Get(pos) != null) &&
                   board.AllPieces.All(piece =>
            {
                if (piece.IsCursed)
                {
                    return true;
                }
                else
                {
                    friendlyMoves.Clear();
                    Move_Billy.GetMoves(board, piece, friendlyMoves);
                    return friendlyMoves.Count == 0;
                }
            }));
        }
Example #3
0
 public MovementResults(Board board, Move_Billy move)
 {
     HostBlockMinCorner = GetHostBlock(board, move.NewPos, move.Piece.Pos, Teams.Friendly);
     GetCaptures(board, Captures, move.Piece.Pos, move.NewPos,
                 Teams.Friendly, HostBlockMinCorner);
 }