Chess.Data.Entities.ChessPiece.ValidateNotAttackingSameTeam C# (CSharp) Method

ValidateNotAttackingSameTeam() protected method

protected ValidateNotAttackingSameTeam ( Square board, Move move ) : void
board Square
move Move
return void
        protected void ValidateNotAttackingSameTeam(Square[][] board, Move move)
        {
            var attacker = GetAttacker(board, move);
            var occupant = GetDestinationPiece(board, move);

            if (occupant != null && occupant.Team == attacker.Team)
                throw new Exception("You may not attack the same team.");
        }