fix: empty board + state stuck in Dialogue

- BoardManager.SetupBoard: fallback to PlacePieces() when campaign
  identities are not configured (prevents empty board)
- CampaignManager: only transition to Dialogue state if StartDialogue
  returns true (prevents state override when dialogue fails)
- Same fix for outro dialogue transition
This commit is contained in:
2026-08-17 22:26:48 -03:00
parent c5915c2e97
commit 801de792ab
5 changed files with 22122 additions and 9050 deletions
+3 -2
View File
@@ -72,7 +72,7 @@ public GameObject kingPrefab; // Prefab del Rey usado como "jefe" en el purgator
{
if (campaignState == null)
{
Debug.LogError("[BoardManager] CampaignState es null. Usando setup estándar.");
Debug.Log("[BoardManager] CampaignState es null. Usando setup estándar.");
PlacePieces();
return;
}
@@ -85,7 +85,8 @@ public GameObject kingPrefab; // Prefab del Rey usado como "jefe" en el purgator
if (availablePieces.Count == 0)
{
Debug.LogError("[BoardManager] No hay piezas disponibles. La campaña debería terminar.");
Debug.LogWarning("[BoardManager] No hay identidades de campaña configuradas. Usando setup estándar.");
PlacePieces();
return;
}
@@ -362,19 +362,22 @@ public class CampaignManager : MonoBehaviour
if (DialogueSystem.Instance != null)
{
// Subscribe BEFORE starting — StartDialogue can fire OnDialogueComplete immediately
// if dialogue is not found, which would skip the transition.
DialogueSystem.Instance.OnDialogueComplete += OnIntroDialogueComplete;
DialogueSystem.Instance.StartDialogue(chapter.introDialogueId);
bool started = DialogueSystem.Instance.StartDialogue(chapter.introDialogueId);
if (started)
{
// Only transition to Dialogue if dialogue actually started
if (GameStateManager.Instance != null)
GameStateManager.Instance.TransitionTo(GameState.Dialogue);
}
// If started=false, OnDialogueComplete already fired → OnIntroDialogueComplete → TransitionToPlaying
}
else
{
Debug.LogWarning("[CampaignManager] DialogueSystem no disponible. Saltando intro.");
TransitionToPlaying();
return;
}
if (GameStateManager.Instance != null)
GameStateManager.Instance.TransitionTo(GameState.Dialogue);
}
private void OnIntroDialogueComplete()
@@ -403,17 +406,20 @@ public class CampaignManager : MonoBehaviour
{
// Subscribe BEFORE starting — same fix as intro.
DialogueSystem.Instance.OnDialogueComplete += OnOutroDialogueComplete;
DialogueSystem.Instance.StartDialogue(CurrentChapter.outroDialogueId);
bool started = DialogueSystem.Instance.StartDialogue(CurrentChapter.outroDialogueId);
if (started)
{
if (GameStateManager.Instance != null)
GameStateManager.Instance.TransitionTo(GameState.Dialogue);
}
// If started=false, OnDialogueComplete already fired → OnOutroDialogueComplete → CompleteChapter
}
else
{
Debug.LogWarning("[CampaignManager] DialogueSystem no disponible. Saltando outro.");
CompleteChapter();
return;
}
if (GameStateManager.Instance != null)
GameStateManager.Instance.TransitionTo(GameState.Dialogue);
}
private void OnOutroDialogueComplete()
File diff suppressed because it is too large Load Diff
+8841 -4486
View File
File diff suppressed because it is too large Load Diff
+8903 -4548
View File
File diff suppressed because it is too large Load Diff