Files
Ajedrez_Purgatorio/Assets/Game/Scripts/Mono/Pieces/Piece.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

88 lines
2.0 KiB
C#

using System.Collections.Generic;
using UnityEngine;
public class Piece : MonoBehaviour
{
[SerializeField] private bool _isWhite;
public bool isWhite
{
get => _isWhite;
set => _isWhite = value;
}
private Vector2Int _currentPos;
public Vector2Int currentPos
{
get => _currentPos;
set => _currentPos = value;
}
[SerializeField] private bool _hasMoved = false;
public bool hasMoved
{
get => _hasMoved;
set => _hasMoved = value;
}
[Header("Identidad Narrativa")]
[Tooltip("Identidad narrativa de esta pieza (solo para piezas blancas)")]
[SerializeField] private PieceIdentity _identity;
public PieceIdentity identity
{
get => _identity;
set => _identity = value;
}
public int pieceValue
{
get
{
return this switch
{
Pawn => 1,
Knight => 3,
Bishop => 3,
Rook => 5,
Queen => 9,
King => 0,
_ => 0
};
}
}
public virtual List<Vector2Int> GetAvailableMoves(Piece[,] board)
{
return new List<Vector2Int>();
}
public virtual List<Vector2Int> GetAttackSquares(Piece[,] board)
{
return GetAvailableMoves(board);
}
protected bool IsInsideBoard(Vector2Int pos)
{
return pos.x >= 0 && pos.x < 8 && pos.y >= 0 && pos.y < 8;
}
public virtual void ShowMoves()
{
if (GameManager.Instance == null || BoardManager.Instance == null)
return;
var moves = GetAvailableMoves(GameManager.Instance.board);
BoardManager.Instance.HideAllIndicators();
foreach (var move in moves)
{
BoardManager.Instance.ShowIndicator(move);
}
}
public virtual void HideMoves()
{
if (BoardManager.Instance == null)
return;
BoardManager.Instance.HideAllIndicators();
}
}