using System.Linq; using UnityEngine; using UnityEngine.SceneManagement; /// /// Debug helper for testing battle scene transitions and victory scenarios /// public class BattleSceneDebugHelper : MonoBehaviour { [Header("Debug Controls")] [Tooltip("Enable debug mode to show additional logging and controls")] public bool enableDebugMode = false; [Header("Scene Testing")] [Tooltip("Name of the map scene to return to")] public string mapSceneName = "MapScene2"; private void Update() { if (!enableDebugMode) return; } private void ForceKillAllEnemies() { Debug.Log("๐Ÿงช [DEBUG] Manually killing all enemies..."); if (GameManager.Instance != null && GameManager.Instance.enemyCharacters != null) { foreach (var enemy in GameManager.Instance.enemyCharacters) { if (enemy != null) { var character = enemy.GetComponent(); if (character != null && !character.IsDead) { character.TakeDamage(1000); // Force death Debug.Log($"๐Ÿ”ช Killed enemy: {enemy.name}"); } } } } } [ContextMenu("Debug Battle State")] public void DebugBattleState() { Debug.Log("๐Ÿ” [DEBUG] Current battle state:"); if (GameManager.Instance != null) { Debug.Log($" Players: {GameManager.Instance.playerCharacters?.Count ?? 0}"); Debug.Log($" Enemies: {GameManager.Instance.enemyCharacters?.Count ?? 0}"); var alivePlayers = GameManager.Instance.GetAlivePlayers(); var aliveEnemies = GameManager.Instance.enemyCharacters?.Where(e => e != null && !e.GetComponent()?.IsDead == true).Count() ?? 0; Debug.Log($" Alive Players: {alivePlayers?.Count ?? 0}"); Debug.Log($" Alive Enemies: {aliveEnemies}"); bool battleShouldEnd = (alivePlayers?.Count ?? 0) == 0 || aliveEnemies == 0; Debug.Log($" Battle should end: {battleShouldEnd}"); } else { Debug.LogError(" GameManager.Instance is null!"); } } private void OnGUI() { if (!enableDebugMode) return; // Simple debug GUI GUILayout.BeginArea(new Rect(10, 10, 300, 200)); GUILayout.Label("Battle Debug Controls", GUI.skin.box); GUILayout.Label("Hotkeys: F1, F2, F3"); GUILayout.EndArea(); } }