using UnityEngine; /// /// Test script to verify team marker camera functionality. /// Attach this to any GameObject to test the camera system. /// public class TeamMarkerCameraTest : MonoBehaviour { [Header("Test Controls")] [Tooltip("Key to run all camera tests")] public KeyCode testAllKey = KeyCode.T; [Tooltip("Key to test team marker centering")] public KeyCode testCenterKey = KeyCode.Y; [Tooltip("Key to test full map view")] public KeyCode testFullMapKey = KeyCode.U; void Update() { if (Input.GetKeyDown(testAllKey)) { RunAllTests(); } if (Input.GetKeyDown(testCenterKey)) { TestTeamMarkerCentering(); } if (Input.GetKeyDown(testFullMapKey)) { TestFullMapView(); } } public void RunAllTests() { Debug.Log("πŸ§ͺ Running Team Marker Camera Tests..."); // Test 1: Check if team placement exists TestTeamPlacementExists(); // Test 2: Check if camera controllers exist TestCameraControllersExist(); // Test 3: Test team marker centering TestTeamMarkerCentering(); // Test 4: Test full map view TestFullMapView(); Debug.Log("βœ… Team Marker Camera Tests Complete!"); } private void TestTeamPlacementExists() { SimpleTeamPlacement teamPlacement = FindFirstObjectByType(); if (teamPlacement == null) { Debug.LogError("❌ SimpleTeamPlacement not found in scene!"); return; } Debug.Log("βœ… SimpleTeamPlacement found"); if (!teamPlacement.IsTeamPlaced()) { Debug.LogWarning("⚠️ Team not yet placed, attempting to place..."); teamPlacement.RandomlyPlaceTeam(); } else { Debug.Log("βœ… Team is placed"); } GameObject teamMarker = teamPlacement.GetTeamMarker(); if (teamMarker != null) { Debug.Log($"βœ… Team marker found at position: {teamMarker.transform.position}"); } else { Debug.LogError("❌ Team marker object not found!"); } } private void TestCameraControllersExist() { // Check for enhanced camera controllers MapCameraController mapCameraController = FindFirstObjectByType(); MMCameraController mmCameraController = FindFirstObjectByType(); TeamMarkerCameraController teamMarkerController = FindFirstObjectByType(); int controllerCount = 0; if (mapCameraController != null) { Debug.Log("βœ… MapCameraController found (enhanced with team marker support)"); controllerCount++; } if (mmCameraController != null) { Debug.Log("βœ… MMCameraController found (enhanced with team marker support)"); controllerCount++; } if (teamMarkerController != null) { Debug.Log("βœ… TeamMarkerCameraController found (universal component)"); controllerCount++; } if (controllerCount == 0) { Debug.LogWarning("⚠️ No enhanced camera controllers found. You may need to add TeamMarkerCameraController to your camera."); } else { Debug.Log($"βœ… Found {controllerCount} camera controller(s) with team marker support"); } } private void TestTeamMarkerCentering() { Debug.Log("🎯 Testing team marker centering..."); // Try to find any camera controller that supports team marker centering TeamMarkerCameraController teamMarkerController = FindFirstObjectByType(); if (teamMarkerController != null) { teamMarkerController.CenterOnTeamMarker(); Debug.Log("βœ… Called CenterOnTeamMarker() on TeamMarkerCameraController"); return; } MapCameraController mapCameraController = FindFirstObjectByType(); if (mapCameraController != null) { mapCameraController.CenterOnTeamMarker(); Debug.Log("βœ… Called CenterOnTeamMarker() on MapCameraController"); return; } MMCameraController mmCameraController = FindFirstObjectByType(); if (mmCameraController != null) { mmCameraController.CenterOnTeamMarker(); Debug.Log("βœ… Called CenterOnTeamMarker() on MMCameraController"); return; } Debug.LogWarning("⚠️ No camera controller with CenterOnTeamMarker() method found!"); } private void TestFullMapView() { Debug.Log("πŸ—ΊοΈ Testing full map view..."); // Try to find any camera controller that supports full map view TeamMarkerCameraController teamMarkerController = FindFirstObjectByType(); if (teamMarkerController != null) { teamMarkerController.ZoomToFullMap(); Debug.Log("βœ… Called ZoomToFullMap() on TeamMarkerCameraController"); return; } MapCameraController mapCameraController = FindFirstObjectByType(); if (mapCameraController != null) { mapCameraController.ZoomToFullMap(); Debug.Log("βœ… Called ZoomToFullMap() on MapCameraController"); return; } MMCameraController mmCameraController = FindFirstObjectByType(); if (mmCameraController != null) { mmCameraController.ZoomToFullMap(); Debug.Log("βœ… Called ZoomToFullMap() on MMCameraController"); return; } Debug.LogWarning("⚠️ No camera controller with ZoomToFullMap() method found!"); } void OnEnable() { Debug.Log($"πŸ§ͺ Team Marker Camera Test script enabled!\n" + $"- {testAllKey}: Run all tests\n" + $"- {testCenterKey}: Test team marker centering\n" + $"- {testFullMapKey}: Test full map view"); } }