示例#1
0
        private async Task MarkEatTo(Path.Path path, bool ignoreValidateMovement)
        {
            if (CurrentChessPiece != null)
            {
                if (CurrentChessPiece.IsWhite() != path.StartCell.CurrentChessPiece?.IsWhite() &&
                    (ignoreValidateMovement || await Board.ValidateMovement(path.StartCell, this)))
                {
                    CanEatHere.Add(path);
                }
                return;
            }

            if (Movements[path.GetNextStep()] != null)
            {
                await Movements[path.GetStep()].MarkEatTo(path, ignoreValidateMovement);
            }
        }
示例#2
0
        private async Task CheckJumpEatTo(Path.Path path, bool ignoreValidateMovement)
        {
            if (path.GetNextStep() == Movement.Direction.Final)
            {
                if (CurrentChessPiece == null && (ignoreValidateMovement || await Board.ValidateMovement(path.StartCell, this)))
                {
                    CanMoveHere.Add(path);
                }
                else if (CurrentChessPiece?.IsWhite() != path.StartCell.CurrentChessPiece?.IsWhite() &&
                         (ignoreValidateMovement ||
                          await Board.ValidateMovement(path.StartCell, this)))
                {
                    CanEatHere.Add(path);
                }
                return;
            }

            if (Movements[path.GetStep()] != null)
            {
                await Movements[path.GetStep()].CheckJumpEatTo(path, ignoreValidateMovement);
            }
        }