mirror of
https://github.com/Earth-Genesis-Games/Ajedrez_Purgatorio.git
synced 2026-09-11 09:47:35 +00:00
chore: cleanup dead code + null safety + BalanceConfig fix
- Delete DadoSystem.cs (empty stub, replaced by DiceSystem) - Delete dead OnPromotionSelected method from GameManager (caused double turn toggle if wired) - PurgatoryManager: null checks on _campaignState before MarkPieceDead/MarkPieceRecovered - BalanceConfig.LoadFromJSON: actually applies JSON via JsonUtility.FromJsonOverwrite
This commit is contained in:
@@ -89,11 +89,8 @@ namespace AjedrezPurgatorio.Data
|
||||
try
|
||||
{
|
||||
string json = File.ReadAllText(path);
|
||||
// Note: Unity's JsonUtility doesn't support nested objects well
|
||||
// For now, we'll use default values and parse manually if needed
|
||||
// In production, consider using Newtonsoft.Json or similar
|
||||
|
||||
Debug.Log("[BalanceConfig] Loaded from JSON (using default values for now).");
|
||||
JsonUtility.FromJsonOverwrite(json, this);
|
||||
Debug.Log("[BalanceConfig] Loaded from JSON successfully.");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class DadoSystem : MonoBehaviour
|
||||
{
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a1180e41d60ca4380b1e79cbd6c16c8b
|
||||
@@ -400,19 +400,6 @@ private GameObject GetPrefabForPromotion(PieceType type, bool isWhite)
|
||||
_ => null
|
||||
};
|
||||
}
|
||||
|
||||
private void OnPromotionSelected(PieceType pieceType)
|
||||
{
|
||||
// Este callback es llamado por PromotionUI
|
||||
// La pieza ya está en el tablero, solo necesitamos promocionarla
|
||||
Debug.Log($"Jugador eligió promover a {pieceType}");
|
||||
|
||||
// Cambiar turno después de promoción
|
||||
_whiteTurn = !_whiteTurn;
|
||||
|
||||
// Disparar evento de cambio de turno
|
||||
OnTurnChanged?.Invoke(_whiteTurn);
|
||||
}
|
||||
|
||||
public void PromotePawn(Piece pawn)
|
||||
{
|
||||
|
||||
@@ -98,15 +98,13 @@ public class PurgatoryManager : MonoBehaviour
|
||||
|
||||
private void OnPlayerDeclinesPurgatory(bool isQuotaExhausted = false)
|
||||
{
|
||||
// Marcar pieza como perdida (no permanente a menos que sea cuota agotada)
|
||||
if (isQuotaExhausted)
|
||||
if (isQuotaExhausted && _campaignState != null)
|
||||
{
|
||||
_campaignState.MarkPieceDead(_currentCapturedPiece);
|
||||
Debug.Log($"[PurgatoryManager] {_currentCapturedPiece.characterName} muere permanentemente (cuota agotada).");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Solo removida del tablero actual
|
||||
Debug.Log($"[PurgatoryManager] {_currentCapturedPiece.characterName} perdida para este tablero.");
|
||||
}
|
||||
|
||||
@@ -153,15 +151,19 @@ public class PurgatoryManager : MonoBehaviour
|
||||
|
||||
private void ProcessPurgatoryResult(PurgatoryWinner winner)
|
||||
{
|
||||
if (_campaignState == null)
|
||||
{
|
||||
Debug.LogWarning("[PurgatoryManager] CampaignState no asignado. No se puede registrar resultado.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (winner == PurgatoryWinner.Player)
|
||||
{
|
||||
// Victoria: pieza recuperada
|
||||
_campaignState.MarkPieceRecovered(_currentCapturedPiece);
|
||||
Debug.Log($"[PurgatoryManager] ¡{_currentCapturedPiece.characterName} recuperada!");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Derrota: pieza muerta permanentemente
|
||||
_campaignState.MarkPieceDead(_currentCapturedPiece);
|
||||
Debug.Log($"[PurgatoryManager] {_currentCapturedPiece.characterName} ha muerto permanentemente.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user