Files
Ajedrez_Purgatorio/Assets/Game/Scripts/Mono/Combat/Pieces/PawnCombat.cs
T
jimmyabv b539aa403e fix: resolve compilation errors, add tests, fix configs, update docs
- Fix 9 CS0101 duplicate classes between Mono/ and Mono/Classic/
  - BoardManager -> ClassicBoardManager, SquareClick -> ClassicSquareClick
  - Delete duplicate Piece/Pawn/King/Queen/Rook/Bishop/Knight from Classic/
  - Merge GetAttackSquares into Piece base class with overrides
- Fix King castling: reject castling through/while in check
- Assign URP pipeline to QualitySettings (6 levels) and GraphicsSettings
- Fix template identifiers (DefaultCompany -> EarthGenesisGames)
- Delete orphaned SampleScene.unity and duplicate URP assets
- Fix test assembly reference (Assembly-CSharp -> AjedrezPurgatorio.Runtime)
- Remove 11 unused packages (multiplayer, visualscripting, terrain, etc.)
- Update BoardInputSystemSpike for ClassicSquareClick
- Write unit tests: CheckDetector, DrawDetector, MoveValidator
- Fix BalanceConfig JSON structure to match C# class fields
- Update stale documentation (~30 files)
  - architecture.md, ADR-0001, roadmap, gate-check, EPIC.md
  - PROJECT_STATUS.md, BLOQUEADORES_JUGABILIDAD.md
  - tech-debt-register.md
- Add Unity Editor setup guide (production/UNITY_EDITOR_SETUP.md)
2026-08-17 20:40:02 -03:00

37 lines
1.0 KiB
C#

// ✅ PawnCombat.cs
using System.Collections.Generic;
using UnityEngine;
public class PawnCombat : PieceCombat
{
public override List<Vector2Int> GetAvailableMoves(PieceCombat[,] board)
{
List<Vector2Int> moves = new();
int dir = isWhite ? 1 : -1;
Vector2Int fwd = new(currentPos.x, currentPos.y + dir);
if (IsInsideBoard(fwd) && board[fwd.x, fwd.y] == null)
{
moves.Add(fwd);
Vector2Int dblFwd = new(currentPos.x, currentPos.y + 2 * dir);
if (!hasMoved && board[dblFwd.x, dblFwd.y] == null)
moves.Add(dblFwd);
}
Vector2Int[] diagonals =
{
new(currentPos.x - 1, currentPos.y + dir),
new(currentPos.x + 1, currentPos.y + dir)
};
foreach (var diag in diagonals)
{
if (IsInsideBoard(diag) && board[diag.x, diag.y] != null && board[diag.x, diag.y].isWhite != isWhite)
moves.Add(diag);
}
return moves;
}
}