Axel Nordh il y a 8 mois
Parent
commit
ab681be6bb

+ 7 - 3
Assets/Scenes/MapScene2.unity

@@ -187,7 +187,7 @@ MonoBehaviour:
   explorationInitialVisible: 80
   expansionCooldown: 5
   terrainContinuityChance: 0.7
-  seed: 456
+  seed: 6668
   mapVisualizer: {fileID: 0}
 --- !u!4 &345809425
 Transform:
@@ -303,7 +303,7 @@ MonoBehaviour:
   teamMarkerPrefab: {fileID: 0}
   teamMarkerMaterial: {fileID: 0}
   markerSize: 1.5
-  markerZOffset: -2
+  markerHeight: 0.5
   markerColor: {r: 0, g: 1, b: 0, a: 1}
   enableBlinking: 1
   blinkSpeed: 0.5
@@ -626,7 +626,11 @@ MonoBehaviour:
   moveSpeed: 10
   zoomSpeed: 5
   minZoom: 2
-  maxZoom: 80
+  maxZoom: 200
+  centerOnTeamKey: 99
+  zoomToFullMapKey: 102
+  focusZoomLevel: 10
+  centeringSpeed: 2
 --- !u!114 &1953346061
 MonoBehaviour:
   m_ObjectHideFlags: 0

+ 101 - 3
Assets/Scripts/BattleFieldMaker/MapCameraController.cs

@@ -7,12 +7,18 @@ public class MapCameraController : MonoBehaviour
     public float moveSpeed = 10f;
     public float zoomSpeed = 5f;
     public float minZoom = 5f;
-    public float maxZoom = 50f;
+    public float maxZoom = 100f; // Increased for better map overview
     public float initialZoom = 35f; // Starting zoom level to see more of the map
 
+    [Header("Team Marker Focus")]
+    public KeyCode centerOnTeamKey = KeyCode.C;
+    public float focusZoomLevel = 15f; // Zoom level when focusing on team marker
+    public float centeringSpeed = 2f; // Speed of camera movement when centering
+
     private Camera cam;
     private Vector3 targetPosition;
     private float targetSize;
+    private SimpleTeamPlacement teamPlacement;
 
     void Start()
     {
@@ -32,10 +38,35 @@ public class MapCameraController : MonoBehaviour
 
         // Ensure camera is orthographic for top-down view
         cam.orthographic = true;
+
+        // Find team placement component
+        teamPlacement = FindFirstObjectByType<SimpleTeamPlacement>();
     }
 
     void Update()
     {
+        // Handle team marker centering
+        if (Input.GetKeyDown(centerOnTeamKey))
+        {
+            CenterOnTeamMarker();
+        }
+
+        // Handle zoom to full map
+        if (Input.GetKeyDown(KeyCode.F))
+        {
+            ZoomToFullMap();
+        }
+
+        // Show help
+        if (Input.GetKeyDown(KeyCode.H))
+        {
+            Debug.Log("💡 Camera Controls:\n" +
+                     $"- {centerOnTeamKey}: Center on team marker\n" +
+                     "- F: Zoom to full map\n" +
+                     "- WASD/Arrows: Move camera\n" +
+                     "- Mouse wheel: Zoom");
+        }
+
         // Only handle camera input if mouse is within the map area
         if (IsMouseInMapArea())
         {
@@ -44,8 +75,75 @@ public class MapCameraController : MonoBehaviour
         }
 
         // Always smooth camera movement (even if input is disabled)
-        transform.position = Vector3.Lerp(transform.position, targetPosition, Time.deltaTime * 5f);
-        cam.orthographicSize = Mathf.Lerp(cam.orthographicSize, targetSize, Time.deltaTime * 5f);
+        transform.position = Vector3.Lerp(transform.position, targetPosition, Time.deltaTime * centeringSpeed);
+        cam.orthographicSize = Mathf.Lerp(cam.orthographicSize, targetSize, Time.deltaTime * centeringSpeed);
+    }
+
+    /// <summary>
+    /// Center the camera on the team marker position
+    /// </summary>
+    public void CenterOnTeamMarker()
+    {
+        if (teamPlacement == null)
+        {
+            teamPlacement = FindFirstObjectByType<SimpleTeamPlacement>();
+        }
+
+        if (teamPlacement != null && teamPlacement.IsTeamPlaced())
+        {
+            GameObject teamMarker = teamPlacement.GetTeamMarker();
+            if (teamMarker != null)
+            {
+                Vector3 teamPos = teamMarker.transform.position;
+
+                // Set target position to center on team marker
+                targetPosition = new Vector3(teamPos.x, transform.position.y, teamPos.z);
+
+                // Optionally adjust zoom level for better focus
+                targetSize = focusZoomLevel;
+
+                Debug.Log($"🎯 Centering camera on team marker at position: {teamPos}");
+            }
+            else
+            {
+                Debug.LogWarning("⚠️ Team marker object not found!");
+            }
+        }
+        else
+        {
+            Debug.LogWarning("⚠️ Team placement not found or team not placed!");
+        }
+    }
+
+    /// <summary>
+    /// Zoom out to show the entire map
+    /// </summary>
+    public void ZoomToFullMap()
+    {
+        // Find the MapMaker2 component to get map dimensions
+        MapMaker2 mapMaker = FindFirstObjectByType<MapMaker2>();
+        if (mapMaker != null)
+        {
+            var mapData = mapMaker.GetMapData();
+            if (mapData != null)
+            {
+                // Calculate map center
+                Vector3 mapCenter = new Vector3(
+                    mapData.Width / 2f,
+                    transform.position.y,
+                    mapData.Height / 2f
+                );
+
+                // Calculate required zoom to fit entire map
+                float mapSize = Mathf.Max(mapData.Width, mapData.Height);
+                float requiredZoom = mapSize * 0.6f; // Add some padding
+
+                targetPosition = mapCenter;
+                targetSize = Mathf.Clamp(requiredZoom, minZoom, maxZoom);
+
+                Debug.Log($"🗺️ Zooming to full map: Size {mapData.Width}x{mapData.Height}, Zoom: {targetSize}");
+            }
+        }
     }
 
     void HandleMovement()

+ 247 - 0
Assets/Scripts/Camera/TeamMarkerCameraController.cs

@@ -0,0 +1,247 @@
+using UnityEngine;
+
+/// <summary>
+/// Universal camera controller for focusing on team marker and managing map overview.
+/// Can be attached to any camera to provide team marker centering functionality.
+/// </summary>
+public class TeamMarkerCameraController : MonoBehaviour
+{
+    [Header("Team Marker Focus Settings")]
+    [Tooltip("Key to center camera on team marker")]
+    public KeyCode centerOnTeamKey = KeyCode.C;
+
+    [Tooltip("Key to zoom out to show full map")]
+    public KeyCode zoomToFullMapKey = KeyCode.F;
+
+    [Tooltip("Key to show help information")]
+    public KeyCode showHelpKey = KeyCode.H;
+
+    [Header("Movement Settings")]
+    [Tooltip("Speed of camera movement when centering")]
+    [Range(0.5f, 5f)]
+    public float centeringSpeed = 2f;
+
+    [Tooltip("Zoom level when focusing on team marker")]
+    [Range(5f, 50f)]
+    public float focusZoomLevel = 15f;
+
+    [Tooltip("Maximum zoom out level for full map view")]
+    [Range(50f, 300f)]
+    public float maxZoomOut = 200f;
+
+    [Header("Auto-Center Settings")]
+    [Tooltip("Automatically center on team marker when it's first placed")]
+    public bool autoCenterOnTeamPlacement = true;
+
+    [Tooltip("Delay before auto-centering (allows map to generate first)")]
+    [Range(0f, 5f)]
+    public float autoCenterDelay = 2f;
+
+    // Private variables
+    private Camera cam;
+    private Vector3 targetPosition;
+    private float targetZoom;
+    private bool isMovingToTarget = false;
+    private SimpleTeamPlacement teamPlacement;
+    private bool hasAutocentered = false;
+
+    void Start()
+    {
+        cam = GetComponent<Camera>();
+        if (cam == null)
+            cam = Camera.main;
+
+        // Initialize target values
+        targetPosition = transform.position;
+        targetZoom = cam.orthographicSize;
+
+        // Find team placement component
+        teamPlacement = FindFirstObjectByType<SimpleTeamPlacement>();
+
+        // Auto-center on team marker after delay if enabled
+        if (autoCenterOnTeamPlacement)
+        {
+            Invoke(nameof(AutoCenterOnTeamMarker), autoCenterDelay);
+        }
+    }
+
+    void Update()
+    {
+        // Handle input
+        HandleInput();
+
+        // Handle smooth movement to target
+        if (isMovingToTarget)
+        {
+            HandleSmoothMovement();
+        }
+    }
+
+    private void HandleInput()
+    {
+        // Center on team marker
+        if (Input.GetKeyDown(centerOnTeamKey))
+        {
+            CenterOnTeamMarker();
+        }
+
+        // Zoom to full map
+        if (Input.GetKeyDown(zoomToFullMapKey))
+        {
+            ZoomToFullMap();
+        }
+
+        // Show help
+        if (Input.GetKeyDown(showHelpKey))
+        {
+            ShowHelp();
+        }
+    }
+
+    private void HandleSmoothMovement()
+    {
+        // Smoothly move camera to target position and zoom
+        transform.position = Vector3.Lerp(transform.position, targetPosition, Time.deltaTime * centeringSpeed);
+        cam.orthographicSize = Mathf.Lerp(cam.orthographicSize, targetZoom, Time.deltaTime * centeringSpeed);
+
+        // Check if we're close enough to stop moving
+        float positionDistance = Vector3.Distance(transform.position, targetPosition);
+        float zoomDistance = Mathf.Abs(cam.orthographicSize - targetZoom);
+
+        if (positionDistance < 0.5f && zoomDistance < 0.5f)
+        {
+            isMovingToTarget = false;
+            Debug.Log("🎯 Camera movement complete");
+        }
+    }
+
+    /// <summary>
+    /// Center the camera on the team marker position
+    /// </summary>
+    public void CenterOnTeamMarker()
+    {
+        if (teamPlacement == null)
+        {
+            teamPlacement = FindFirstObjectByType<SimpleTeamPlacement>();
+        }
+
+        if (teamPlacement != null && teamPlacement.IsTeamPlaced())
+        {
+            GameObject teamMarker = teamPlacement.GetTeamMarker();
+            if (teamMarker != null)
+            {
+                Vector3 teamPos = teamMarker.transform.position;
+
+                // Set target position to center on team marker (preserve camera height)
+                targetPosition = new Vector3(teamPos.x, transform.position.y, teamPos.z);
+                targetZoom = focusZoomLevel;
+                isMovingToTarget = true;
+
+                Debug.Log($"🎯 Centering camera on team marker at position: {teamPos}");
+            }
+            else
+            {
+                Debug.LogWarning("⚠️ Team marker object not found!");
+            }
+        }
+        else
+        {
+            Debug.LogWarning("⚠️ Team placement not found or team not placed!");
+        }
+    }
+
+    /// <summary>
+    /// Zoom out to show the entire map
+    /// </summary>
+    public void ZoomToFullMap()
+    {
+        // Try to find MapMaker2 first
+        MapMaker2 mapMaker = FindFirstObjectByType<MapMaker2>();
+        if (mapMaker != null)
+        {
+            var mapData = mapMaker.GetMapData();
+            if (mapData != null)
+            {
+                SetFullMapView(mapData.Width, mapData.Height);
+                return;
+            }
+        }
+
+        // Last resort: Use a reasonable default size
+        Debug.LogWarning("⚠️ Could not find map data, using default map size for full view");
+        SetFullMapView(100, 100);
+    }
+
+    private void SetFullMapView(int mapWidth, int mapHeight)
+    {
+        // Calculate map center
+        targetPosition = new Vector3(
+            mapWidth / 2f,
+            transform.position.y,
+            mapHeight / 2f
+        );
+
+        // Calculate required zoom to fit entire map with some padding
+        float mapSize = Mathf.Max(mapWidth, mapHeight);
+        targetZoom = Mathf.Min(mapSize * 0.8f, maxZoomOut);
+
+        isMovingToTarget = true;
+
+        Debug.Log($"🗺️ Zooming to full map: Size {mapWidth}x{mapHeight}, Zoom: {targetZoom}");
+    }
+
+    /// <summary>
+    /// Auto-center on team marker (called after delay)
+    /// </summary>
+    private void AutoCenterOnTeamMarker()
+    {
+        if (!hasAutocentered && autoCenterOnTeamPlacement)
+        {
+            hasAutocentered = true;
+            CenterOnTeamMarker();
+        }
+    }
+
+    /// <summary>
+    /// Show help information in console
+    /// </summary>
+    private void ShowHelp()
+    {
+        Debug.Log("🎮 Team Marker Camera Controls:\n" +
+                 $"- {centerOnTeamKey}: Center camera on team marker\n" +
+                 $"- {zoomToFullMapKey}: Zoom out to show full map\n" +
+                 $"- {showHelpKey}: Show this help\n" +
+                 "- Mouse wheel: Zoom in/out\n" +
+                 "- WASD/Arrow keys: Move camera (if supported by main controller)\n" +
+                 "- Middle mouse: Drag camera (if supported by main controller)");
+    }
+
+    /// <summary>
+    /// Stop any automatic camera movement (useful when user wants manual control)
+    /// </summary>
+    public void StopAutoMovement()
+    {
+        isMovingToTarget = false;
+        targetPosition = transform.position;
+        targetZoom = cam.orthographicSize;
+    }
+
+    /// <summary>
+    /// Force update team placement reference (useful if team placement changes)
+    /// </summary>
+    public void RefreshTeamPlacement()
+    {
+        teamPlacement = FindFirstObjectByType<SimpleTeamPlacement>();
+    }
+
+    void OnEnable()
+    {
+        // Show brief help when component is enabled
+        Invoke(nameof(ShowBriefHelp), 1f);
+    }
+
+    private void ShowBriefHelp()
+    {
+        Debug.Log($"🎯 Team Marker Camera Controller enabled! Press {showHelpKey} for help.");
+    }
+}

+ 1 - 1
Assets/Scripts/Controllers/CinemachineCameraController.cs

@@ -14,7 +14,7 @@ public class CinemachineCameraController : MonoBehaviour
 
     [Header("Camera Controls")]
     public float minZoom = 15f;
-    public float maxZoom = 80f;
+    public float maxZoom = 200f;
     public float zoomSpeed = 10f;
     public float panSpeed = 30f;
     public float cameraAngle = 60f; // degrees

+ 197 - 0
Assets/Scripts/Debug/TeamMarkerCameraTest.cs

@@ -0,0 +1,197 @@
+using UnityEngine;
+
+/// <summary>
+/// Test script to verify team marker camera functionality.
+/// Attach this to any GameObject to test the camera system.
+/// </summary>
+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<SimpleTeamPlacement>();
+
+        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<MapCameraController>();
+        MMCameraController mmCameraController = FindFirstObjectByType<MMCameraController>();
+        TeamMarkerCameraController teamMarkerController = FindFirstObjectByType<TeamMarkerCameraController>();
+
+        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<TeamMarkerCameraController>();
+        if (teamMarkerController != null)
+        {
+            teamMarkerController.CenterOnTeamMarker();
+            Debug.Log("✅ Called CenterOnTeamMarker() on TeamMarkerCameraController");
+            return;
+        }
+
+        MapCameraController mapCameraController = FindFirstObjectByType<MapCameraController>();
+        if (mapCameraController != null)
+        {
+            mapCameraController.CenterOnTeamMarker();
+            Debug.Log("✅ Called CenterOnTeamMarker() on MapCameraController");
+            return;
+        }
+
+        MMCameraController mmCameraController = FindFirstObjectByType<MMCameraController>();
+        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<TeamMarkerCameraController>();
+        if (teamMarkerController != null)
+        {
+            teamMarkerController.ZoomToFullMap();
+            Debug.Log("✅ Called ZoomToFullMap() on TeamMarkerCameraController");
+            return;
+        }
+
+        MapCameraController mapCameraController = FindFirstObjectByType<MapCameraController>();
+        if (mapCameraController != null)
+        {
+            mapCameraController.ZoomToFullMap();
+            Debug.Log("✅ Called ZoomToFullMap() on MapCameraController");
+            return;
+        }
+
+        MMCameraController mmCameraController = FindFirstObjectByType<MMCameraController>();
+        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");
+    }
+}

+ 5 - 5
Assets/Scripts/Map/SimpleTeamPlacement.cs

@@ -14,7 +14,7 @@ public class SimpleTeamPlacement : MonoBehaviour
     [Range(0.5f, 3f)]
     public float markerSize = 1.5f;
     [Range(-5f, 5f)]
-    public float markerZOffset = -2f; // Negative to place in front of map
+    public float markerHeight = 0.5f; // Y coordinate height above map tiles
     public Color markerColor = Color.green;
 
     [Header("Animation Settings")]
@@ -402,8 +402,8 @@ public class SimpleTeamPlacement : MonoBehaviour
                 Vector3 correctWorldPos = explorationManager.ConvertExplorationToWorldCoordinates(currentTeamPosition);
                 teamMarkerInstance.transform.position = new Vector3(
                     correctWorldPos.x,
-                    correctWorldPos.y,
-                    markerZOffset
+                    markerHeight, // Y coordinate height above map tiles
+                    correctWorldPos.z  // Use Z coordinate for map Y position
                 );
 
                 return;
@@ -413,8 +413,8 @@ public class SimpleTeamPlacement : MonoBehaviour
         // Fallback for non-exploration mode: use direct coordinate mapping
         Vector3 worldPosition = new Vector3(
             worldCoordinates.x * tileSize,
-            worldCoordinates.y * tileSize,
-            markerZOffset // Use configurable Z offset to place in front of map
+            markerHeight, // Y coordinate height above map tiles
+            worldCoordinates.y * tileSize // Map Y becomes world Z for top-down view
         );
 
         teamMarkerInstance.transform.position = worldPosition;

+ 15 - 14
Assets/Scripts/Map/TeamTravelSystem.cs

@@ -55,7 +55,7 @@ public class TeamTravelSystem : MonoBehaviour
     [Range(0.1f, 5f)]
     public float pathLineWidth = 2.5f; // Increased for much better visibility
     [Range(-10f, 10f)]
-    public float pathLineZOffset = -2f; // Moved further forward to appear above roads
+    public float pathLineHeight = 1f; // Height above map tiles for path lines
 
     [Header("Debug")]
     public bool showDebugLogs = false;
@@ -1023,7 +1023,7 @@ public class TeamTravelSystem : MonoBehaviour
         for (int i = 0; i < route.path.Count; i++)
         {
             Vector3 worldPos = TileToWorldPosition(route.path[i]);
-            worldPos.z = pathLineZOffset; // Place in front of map
+            worldPos.y = pathLineHeight; // Place above map tiles
             lineRenderer.SetPosition(i, worldPos);
         }
 
@@ -1446,9 +1446,9 @@ public class TeamTravelSystem : MonoBehaviour
                 Debug.Log($"🔴 Set team marker to bright red for visibility");
             }
 
-            // Force position to be in front of everything
+            // Force position to be visible above map (adjust Y for top-down view)
             var pos = teamMarker.transform.position;
-            teamMarker.transform.position = new Vector3(pos.x, pos.y, -5f);
+            teamMarker.transform.position = new Vector3(pos.x, 2f, pos.z); // Raise above map for visibility
 
             // Stop any blinking coroutines in SimpleTeamPlacement using reflection
             try
@@ -1530,8 +1530,8 @@ public class TeamTravelSystem : MonoBehaviour
             return hit.point;
         }
 
-        // Fallback: use camera plane projection at Z=0 (map level)
-        Plane mapPlane = new Plane(Vector3.back, Vector3.zero); // Z=0 plane facing forward
+        // Fallback: use camera plane projection at Y=0 (map level) for top-down view
+        Plane mapPlane = new Plane(Vector3.up, Vector3.zero); // Y=0 plane facing up for top-down camera
         if (mapPlane.Raycast(ray, out float distance))
         {
             Vector3 point = ray.GetPoint(distance);
@@ -1548,7 +1548,7 @@ public class TeamTravelSystem : MonoBehaviour
         float tileSize = mapMaker?.mapVisualizer?.tileSize ?? 1f;
         return new Vector2Int(
             Mathf.RoundToInt(worldPos.x / tileSize),
-            Mathf.RoundToInt(worldPos.y / tileSize)
+            Mathf.RoundToInt(worldPos.z / tileSize) // Use Z coordinate for map Y in top-down view
         );
     }
 
@@ -1557,8 +1557,8 @@ public class TeamTravelSystem : MonoBehaviour
         float tileSize = mapMaker?.mapVisualizer?.tileSize ?? 1f;
         return new Vector3(
             tilePos.x * tileSize,
-            tilePos.y * tileSize,
-            0f
+            0f, // Y=0 for tiles at ground level
+            tilePos.y * tileSize // Map Y coordinate becomes world Z coordinate for top-down view
         );
     }
 
@@ -1932,23 +1932,24 @@ public class TeamTravelSystem : MonoBehaviour
         lineRenderer.sortingOrder = sortingOrder;
         lineRenderer.textureMode = LineTextureMode.Tile;
 
-        // Selected route gets priority Z-offset (closer to camera)
-        float zOffset = pathLineZOffset - (isSelected ? 1.0f : layerIndex * 0.2f);
+        // Selected route gets priority Y-offset (higher above map)
+        float zOffset = pathLineHeight + (isSelected ? 1.0f : layerIndex * 0.2f);
 
         // Set path points
         for (int j = 0; j < route.path.Count; j++)
         {
-            Vector3 worldPos = new Vector3(route.path[j].x, route.path[j].y, 0);
+            // Convert map coordinates to world coordinates properly for top-down view
+            Vector3 worldPos = TileToWorldPosition(route.path[j]);
 
             // Add slight offset for non-selected routes to prevent exact overlap
             if (!isSelected)
             {
                 float offsetAmount = layerIndex * 0.02f;
                 worldPos.x += Mathf.Sin(j + layerIndex) * offsetAmount;
-                worldPos.y += Mathf.Cos(j + layerIndex) * offsetAmount;
+                worldPos.z += Mathf.Cos(j + layerIndex) * offsetAmount; // Use Z for map Y offset
             }
 
-            worldPos.z = zOffset;
+            worldPos.y = zOffset; // Use Y for height/depth positioning
             lineRenderer.SetPosition(j, worldPos);
         }
 

+ 17 - 17
Assets/Scripts/MapMaker2/Exploration/ExplorationManager.cs

@@ -136,7 +136,7 @@ public class ExplorationManager
         bool isShowingFullMap = exploredBounds.width >= fullMapWidth - 5 && exploredBounds.height >= fullMapHeight - 5;
 
         Debug.Log("=== COORDINATE CONVERSION TEST ===");
-        Debug.Log($"Team Marker World Position: ({worldPos.x:F1}, {worldPos.y:F1})");
+        Debug.Log($"Team Marker World Position: ({worldPos.x:F1}, {worldPos.z:F1})");
         Debug.Log($"Team Placement Stored Position: ({storedPos.x}, {storedPos.y})");
         Debug.Log($"Explored Bounds: {exploredBounds}");
         Debug.Log($"Is Showing Full Map: {isShowingFullMap}");
@@ -220,17 +220,17 @@ public class ExplorationManager
         Vector3 teamMarkerWorldPos = teamMarker.transform.position;
 
         Debug.Log("=== POSITIONING TEST AFTER FIX ===");
-        Debug.Log($"📍 Team Marker World Position: ({teamMarkerWorldPos.x:F1}, {teamMarkerWorldPos.y:F1})");
+        Debug.Log($"📍 Team Marker World Position: ({teamMarkerWorldPos.x:F1}, {teamMarkerWorldPos.z:F1})");
         Debug.Log($"🗂️ Stored Team Position: ({storedPos.x}, {storedPos.y})");
         Debug.Log($"🗺️ Explored Bounds: {exploredBounds}");
 
         // Calculate expected world position for the center tile
         Vector3 expectedCenterTileWorldPos = new Vector3(
             (exploredBounds.x + exploredBounds.width / 2f),
-            (exploredBounds.y + exploredBounds.height / 2f),
-            0
+            0,
+            (exploredBounds.y + exploredBounds.height / 2f)
         );
-        Debug.Log($"🎯 Expected Center Tile World Position: ({expectedCenterTileWorldPos.x:F1}, {expectedCenterTileWorldPos.y:F1})");
+        Debug.Log($"🎯 Expected Center Tile World Position: ({expectedCenterTileWorldPos.x:F1}, {expectedCenterTileWorldPos.z:F1})");
 
         // Check camera position
         Camera mainCam = Camera.main;
@@ -593,7 +593,7 @@ public class ExplorationManager
         // Convert world position to base tile coordinates
         Vector2Int baseTilePos = new Vector2Int(
             Mathf.RoundToInt(worldPosition.x),
-            Mathf.RoundToInt(worldPosition.y)
+            Mathf.RoundToInt(worldPosition.z)  // Use Z for map Y coordinate
         );
 
         // Get current exploration bounds to determine coordinate system
@@ -626,7 +626,7 @@ public class ExplorationManager
                 explorationCoords.y = Mathf.Clamp(explorationCoords.y, 0, (int)exploredBounds.height - 1);
             }
 
-            Debug.Log($"🌍 FULL MAP: World({worldPosition.x:F1}, {worldPosition.y:F1}) → Exploration({explorationCoords}) [LOD:{lodLevel}]");
+            Debug.Log($"🌍 FULL MAP: World({worldPosition.x:F1}, {worldPosition.z:F1}) → Exploration({explorationCoords}) [LOD:{lodLevel}]");
             return explorationCoords;
         }
         else
@@ -655,7 +655,7 @@ public class ExplorationManager
                 explorationCoords.y = Mathf.Clamp(explorationCoords.y, 0, (int)exploredBounds.height - 1);
             }
 
-            Debug.Log($"🔄 PARTIAL: World({worldPosition.x:F1}, {worldPosition.y:F1}) → Base({baseTilePos}) → Exploration({explorationCoords}) [LOD:{lodLevel}]");
+            Debug.Log($"🔄 PARTIAL: World({worldPosition.x:F1}, {worldPosition.z:F1}) → Base({baseTilePos}) → Exploration({explorationCoords}) [LOD:{lodLevel}]");
             return explorationCoords;
         }
     }
@@ -710,9 +710,9 @@ public class ExplorationManager
             }
         }
 
-        Vector3 worldPos = new Vector3(fullMapCoords.x, fullMapCoords.y, 0);
+        Vector3 worldPos = new Vector3(fullMapCoords.x, 0, fullMapCoords.y);
 
-        Debug.Log($"🔄 Exploration({explorationCoords}) → FullMap({fullMapCoords}) → World({worldPos.x:F1}, {worldPos.y:F1}) [LOD:{lodLevel}, FullMap:{isShowingFullMap}]");
+        Debug.Log($"🔄 Exploration({explorationCoords}) → FullMap({fullMapCoords}) → World({worldPos.x:F1}, {worldPos.z:F1}) [LOD:{lodLevel}, FullMap:{isShowingFullMap}]");
 
         return worldPos;
     }
@@ -742,7 +742,7 @@ public class ExplorationManager
         if (storedPosition != correctExplorationCoords)
         {
             Debug.Log($"🔧 Coordinate mismatch detected: Stored({storedPosition}) ≠ Calculated({correctExplorationCoords})");
-            Debug.Log($"   World position: ({currentWorldPos.x:F1}, {currentWorldPos.y:F1})");
+            Debug.Log($"   World position: ({currentWorldPos.x:F1}, {currentWorldPos.z:F1})");
 
             // Fix the mismatch by updating the stored position to match the world position
             // This preserves the actual visual location of the marker
@@ -752,7 +752,7 @@ public class ExplorationManager
         }
         else
         {
-            Debug.Log($"✅ Coordinates are synchronized: World({currentWorldPos.x:F1}, {currentWorldPos.y:F1}) → Exploration({correctExplorationCoords})");
+            Debug.Log($"✅ Coordinates are synchronized: World({currentWorldPos.x:F1}, {currentWorldPos.z:F1}) → Exploration({correctExplorationCoords})");
         }
     }
 
@@ -774,7 +774,7 @@ public class ExplorationManager
         bool isShowingFullMap = (exploredBounds.width >= fullMapWidth - 5 && exploredBounds.height >= fullMapHeight - 5);
 
         Debug.Log("=== COORDINATE DEBUG ===");
-        Debug.Log($"World Position: ({worldPos.x:F1}, {worldPos.y:F1})");
+        Debug.Log($"World Position: ({worldPos.x:F1}, {worldPos.z:F1})");
         Debug.Log($"Stored Position: ({storedPos.x}, {storedPos.y})");
         Debug.Log($"Calculated Position: ({calculatedPos.x}, {calculatedPos.y})");
         Debug.Log($"Explored Bounds: {exploredBounds}");
@@ -810,7 +810,7 @@ public class ExplorationManager
         // Force update the stored position
         teamPlacement.UpdateMarkerAfterMapChange(correctExplorationCoords);
 
-        Debug.Log($"🔧 FORCED coordinate sync: World({currentWorldPos.x:F1}, {currentWorldPos.y:F1}) → Exploration({correctExplorationCoords})");
+        Debug.Log($"🔧 FORCED coordinate sync: World({currentWorldPos.x:F1}, {currentWorldPos.z:F1}) → Exploration({correctExplorationCoords})");
         Debug.Log($"✅ Team marker position forcibly synchronized");
     }
 
@@ -1640,7 +1640,7 @@ public class ExplorationManager
         // Convert to LOD-adjusted coordinates
         Vector2Int newTilePos = new Vector2Int(
             Mathf.RoundToInt(currentWorldPos.x) / lod,
-            Mathf.RoundToInt(currentWorldPos.y) / lod
+            Mathf.RoundToInt(currentWorldPos.z) / lod
         );
 
         int visibleWidth = (int)exploredBounds.width / lod;
@@ -1673,7 +1673,7 @@ public class ExplorationManager
         // Assuming 1 unit = 1 tile (adjust if your tile scale is different)
         Vector2Int newTilePos = new Vector2Int(
             Mathf.RoundToInt(currentWorldPos.x),
-            Mathf.RoundToInt(currentWorldPos.y)
+            Mathf.RoundToInt(currentWorldPos.z)
         );
 
         // Ensure the position is within the new visible map bounds
@@ -1686,7 +1686,7 @@ public class ExplorationManager
         // Update the team placement with the corrected position
         teamPlacement.UpdateMarkerAfterMapChange(newTilePos);
 
-        Debug.Log($"🔧 Fixed team marker: World({currentWorldPos.x:F1}, {currentWorldPos.y:F1}) → Tile({newTilePos.x}, {newTilePos.y})");
+        Debug.Log($"🔧 Fixed team marker: World({currentWorldPos.x:F1}, {currentWorldPos.z:F1}) → Tile({newTilePos.x}, {newTilePos.y})");
     }    /// <summary>
          /// Copy settlements from full map to visible map, adjusting coordinates
          /// </summary>

+ 1 - 1
Assets/Scripts/MapMaker2/MapMaker2.cs

@@ -371,7 +371,7 @@ public class MapMaker2 : MonoBehaviour
             mapVisualizer.VisualizeMap(mapData);
         }
 
-        Debug.Log($"Map generated with size: {mapData.Width}x{mapData.Height}");
+        Debug.Log($"Map generated with size: {mapData.Width}x{mapData.Height} using sprite-based tiles rotated for top-down view");
         Debug.Log($"Towns: {mapData.GetTowns().Count}, Villages: {mapData.GetVillages().Count}");
     }
 

+ 1 - 1
Assets/Scripts/MapMaker2/MapMaker2Controller.cs

@@ -40,7 +40,7 @@ public class MapMaker2Controller : MonoBehaviour
 
             // Configure the team placement
             teamPlacement.markerSize = 1.5f;
-            teamPlacement.markerZOffset = -2f;
+            teamPlacement.markerHeight = 0.5f;
             teamPlacement.markerColor = Color.green;
             teamPlacement.enableBlinking = true;
         }

+ 0 - 506
Assets/Scripts/MapMaker2/SimpleMapMaker2.cs

@@ -1,506 +0,0 @@
-using UnityEngine;
-
-/// <summary>
-/// Simplified MapMaker2 - Basic map generation with team placement on towns/villages
-/// No exploration or expansion systems - just a clean, working map
-/// </summary>
-public class SimpleMapMaker2 : MonoBehaviour
-{
-    [Header("Basic Map Settings")]
-    public int mapSize = 100;
-    public int seed = 12345;
-
-    [Header("Team Placement")]
-    public GameObject teamMarkerPrefab;
-
-    [Header("Visualization")]
-    public MapVisualizer mapVisualizer;
-
-    // Core components
-    private MapData mapData;
-    private Transform teamMarker;
-
-    void Start()
-    {
-        GenerateSimpleMap();
-    }
-
-    /// <summary>
-    /// Generate a simple map and place team marker on a town/village
-    /// </summary>
-    public void GenerateSimpleMap()
-    {
-        Debug.Log("🗺️ SimpleMapMaker2: Generating basic map...");
-
-        // Generate basic map data
-        CreateBasicMapData();
-
-        // Visualize the map
-        if (mapVisualizer != null)
-        {
-            mapVisualizer.VisualizeMap(mapData);
-            Debug.Log("✅ Map visualization complete");
-        }
-        else
-        {
-            Debug.LogWarning("⚠️ MapVisualizer not assigned - creating simple cubes for visualization");
-            CreateSimpleCubeVisualization();
-        }
-
-        // Place team marker on a town/village
-        PlaceTeamMarkerOnTown();
-
-        Debug.Log($"🎯 SimpleMapMaker2: Map generation complete - Size: {mapSize}x{mapSize}");
-    }
-
-    /// <summary>
-    /// Create basic map data with terrain and settlements
-    /// </summary>
-    private void CreateBasicMapData()
-    {
-        Random.InitState(seed);
-
-        mapData = new MapData(mapSize, mapSize);
-
-        // Generate basic terrain
-        for (int x = 0; x < mapSize; x++)
-        {
-            for (int y = 0; y < mapSize; y++)
-            {
-                // Simple terrain generation
-                float noise = Mathf.PerlinNoise(x * 0.1f, y * 0.1f);
-
-                MapTile tile = mapData.GetTile(x, y);
-                if (tile != null)
-                {
-                    if (noise < 0.3f)
-                    {
-                        tile.terrainType = TerrainType.Plains;
-                    }
-                    else if (noise < 0.6f)
-                    {
-                        tile.terrainType = TerrainType.Forest;
-                    }
-                    else if (noise < 0.8f)
-                    {
-                        tile.terrainType = TerrainType.Plains; // Use plains for hills
-                        tile.height = 1f; // Use height for elevation
-                    }
-                    else
-                    {
-                        tile.terrainType = TerrainType.Mountain;
-                    }
-                }
-            }
-        }
-
-        // Add some roads
-        AddBasicRoads();
-
-        // Add settlements (towns and villages)
-        AddSettlements();
-
-        Debug.Log($"📊 Basic map data created: {mapSize}x{mapSize}");
-    }
-
-    /// <summary>
-    /// Add basic road network
-    /// </summary>
-    private void AddBasicRoads()
-    {
-        // Horizontal road across the middle
-        int midY = mapSize / 2;
-        for (int x = 0; x < mapSize; x++)
-        {
-            MapTile tile = mapData.GetTile(x, midY);
-            if (tile != null && tile.terrainType != TerrainType.Mountain)
-            {
-                tile.featureType = FeatureType.Road;
-            }
-        }
-
-        // Vertical road across the middle
-        int midX = mapSize / 2;
-        for (int y = 0; y < mapSize; y++)
-        {
-            MapTile tile = mapData.GetTile(midX, y);
-            if (tile != null && tile.terrainType != TerrainType.Mountain)
-            {
-                tile.featureType = FeatureType.Road;
-            }
-        }
-
-        Debug.Log("🛤️ Basic roads added");
-    }
-
-    /// <summary>
-    /// Add towns and villages to the map
-    /// </summary>
-    private void AddSettlements()
-    {
-        // Add a few towns and villages
-        Vector2Int[] settlementPositions = {
-            new Vector2Int(25, 25),
-            new Vector2Int(75, 25),
-            new Vector2Int(25, 75),
-            new Vector2Int(75, 75),
-            new Vector2Int(50, 50), // Center town
-            new Vector2Int(30, 60),
-            new Vector2Int(70, 40)
-        };
-
-        for (int i = 0; i < settlementPositions.Length; i++)
-        {
-            Vector2Int pos = settlementPositions[i];
-
-            // Make sure position is valid
-            if (pos.x >= 0 && pos.x < mapSize && pos.y >= 0 && pos.y < mapSize)
-            {
-                MapTile tile = mapData.GetTile(pos.x, pos.y);
-                if (tile != null)
-                {
-                    // First three are towns, rest are villages
-                    FeatureType settlementType = i < 3 ? FeatureType.Town : FeatureType.Village;
-                    tile.featureType = settlementType;
-
-                    // Give settlements names
-                    if (settlementType == FeatureType.Town)
-                    {
-                        tile.name = $"Town_{i + 1}";
-                    }
-                    else
-                    {
-                        tile.name = $"Village_{i + 1}";
-                    }
-
-                    Debug.Log($"🏘️ Placed {settlementType} at ({pos.x}, {pos.y})");
-                }
-            }
-        }
-    }
-
-    /// <summary>
-    /// Place team marker on a town or village
-    /// </summary>
-    private void PlaceTeamMarkerOnTown()
-    {
-        // Find a suitable town or village
-        Vector2Int? townPosition = FindTownOrVillage();
-
-        if (townPosition.HasValue)
-        {
-            PlaceTeamMarkerAt(townPosition.Value);
-        }
-        else
-        {
-            // Fallback to center if no town found
-            Debug.LogWarning("⚠️ No town/village found, placing team marker at center");
-            PlaceTeamMarkerAt(new Vector2Int(mapSize / 2, mapSize / 2));
-        }
-    }
-
-    /// <summary>
-    /// Find the first town or village on the map
-    /// </summary>
-    private Vector2Int? FindTownOrVillage()
-    {
-        for (int x = 0; x < mapSize; x++)
-        {
-            for (int y = 0; y < mapSize; y++)
-            {
-                MapTile tile = mapData.GetTile(x, y);
-                if (tile != null && (tile.featureType == FeatureType.Town || tile.featureType == FeatureType.Village))
-                {
-                    return new Vector2Int(x, y);
-                }
-            }
-        }
-        return null;
-    }
-
-    /// <summary>
-    /// Place team marker at specific map coordinates
-    /// </summary>
-    private void PlaceTeamMarkerAt(Vector2Int mapPos)
-    {
-        // Find existing team marker or create one
-        GameObject teamMarkerObj = GameObject.Find("TeamMarker");
-
-        if (teamMarkerObj == null)
-        {
-            // Create a simple team marker if none exists
-            if (teamMarkerPrefab != null)
-            {
-                teamMarkerObj = Instantiate(teamMarkerPrefab);
-                teamMarkerObj.name = "TeamMarkerSimpleMapMaker2";
-                Debug.Log("🎯 Created new TeamMarker from prefab");
-            }
-            else
-            {
-                // Create a simple sphere as team marker
-                teamMarkerObj = GameObject.CreatePrimitive(PrimitiveType.Sphere);
-                teamMarkerObj.name = "TeamMarkerSimplMapMaker2";
-                teamMarkerObj.transform.localScale = new Vector3(2f, 2f, 2f);
-
-                // Make it green and easily visible
-                Renderer renderer = teamMarkerObj.GetComponent<Renderer>();
-                if (renderer != null)
-                {
-                    renderer.material.color = Color.green;
-                }
-
-                Debug.Log("🎯 Created simple sphere TeamMarker");
-            }
-        }
-
-        if (teamMarkerObj != null)
-        {
-            // Convert map coordinates to world position
-            Vector3 worldPos = new Vector3(mapPos.x, 1f, mapPos.y); // Y=1 to be above ground
-            teamMarkerObj.transform.position = worldPos;
-            teamMarker = teamMarkerObj.transform;
-
-            Debug.Log($"📍 Team marker placed at map position ({mapPos.x}, {mapPos.y}) = world position {worldPos}");
-
-            // Log what type of settlement we're on
-            MapTile tile = mapData.GetTile(mapPos.x, mapPos.y);
-            if (tile != null)
-            {
-                Debug.Log($"🏘️ Team marker placed on: Terrain={tile.terrainType}, Feature={tile.featureType}");
-                if (!string.IsNullOrEmpty(tile.name))
-                {
-                    Debug.Log($"🏘️ Settlement name: {tile.name}");
-                }
-            }
-        }
-        else
-        {
-            Debug.LogError("❌ Could not create TeamMarker!");
-        }
-    }
-
-    /// <summary>
-    /// Context menu helper to regenerate map
-    /// </summary>
-    [ContextMenu("Generate New Map")]
-    public void RegenerateMap()
-    {
-        seed = Random.Range(1, 99999);
-        GenerateSimpleMap();
-    }
-
-    /// <summary>
-    /// Context menu helper to disable conflicting systems
-    /// </summary>
-    [ContextMenu("Setup Simple System (Disable Conflicts)")]
-    public void SetupSimpleSystem()
-    {
-        Debug.Log("🔧 Setting up simple system by disabling conflicting components...");
-
-        // Disable SimpleTeamPlacement if present
-        SimpleTeamPlacement teamPlacement = FindFirstObjectByType<SimpleTeamPlacement>();
-        if (teamPlacement != null)
-        {
-            teamPlacement.enabled = false;
-            Debug.Log("🚫 Disabled SimpleTeamPlacement component");
-        }
-
-        // Disable old TravelUI if present
-        TravelUI oldTravelUI = FindFirstObjectByType<TravelUI>();
-        if (oldTravelUI != null)
-        {
-            oldTravelUI.enabled = false;
-            Debug.Log("🚫 Disabled old TravelUI component");
-        }
-
-        // Disable TeamTravelSystem if present
-        TeamTravelSystem travelSystem = FindFirstObjectByType<TeamTravelSystem>();
-        if (travelSystem != null)
-        {
-            travelSystem.enabled = false;
-            Debug.Log("🚫 Disabled TeamTravelSystem component");
-        }
-
-        // Disable ExplorationManager if present (search by component name)
-        MonoBehaviour[] allComponents = FindObjectsByType<MonoBehaviour>(FindObjectsSortMode.None);
-        foreach (var component in allComponents)
-        {
-            if (component.GetType().Name == "ExplorationManager")
-            {
-                component.enabled = false;
-                Debug.Log("🚫 Disabled ExplorationManager component");
-                break;
-            }
-        }
-
-        Debug.Log("✅ Simple system setup complete - conflicting systems disabled");
-
-        // Regenerate the map to ensure clean state
-        GenerateSimpleMap();
-    }
-
-    /// <summary>
-    /// Context menu helper to place team marker on different town
-    /// </summary>
-    [ContextMenu("Move Team to Random Town")]
-    public void MoveTeamToRandomTown()
-    {
-        // Find all towns and villages
-        var settlements = new System.Collections.Generic.List<Vector2Int>();
-
-        for (int x = 0; x < mapSize; x++)
-        {
-            for (int y = 0; y < mapSize; y++)
-            {
-                MapTile tile = mapData.GetTile(x, y);
-                if (tile != null && (tile.featureType == FeatureType.Town || tile.featureType == FeatureType.Village))
-                {
-                    settlements.Add(new Vector2Int(x, y));
-                }
-            }
-        }
-
-        if (settlements.Count > 0)
-        {
-            int randomIndex = Random.Range(0, settlements.Count);
-            PlaceTeamMarkerAt(settlements[randomIndex]);
-        }
-        else
-        {
-            Debug.LogWarning("⚠️ No settlements found on map");
-        }
-    }
-
-    /// <summary>
-    /// Create simple cube visualization when MapVisualizer is not available
-    /// </summary>
-    private void CreateSimpleCubeVisualization()
-    {
-        // Create a parent object for all tiles
-        GameObject mapContainer = GameObject.Find("MapContainer");
-        if (mapContainer == null)
-        {
-            mapContainer = new GameObject("MapContainer");
-        }
-
-        // Clear existing tiles
-        for (int i = mapContainer.transform.childCount - 1; i >= 0; i--)
-        {
-            DestroyImmediate(mapContainer.transform.GetChild(i).gameObject);
-        }
-
-        // Create simple cubes for visualization
-        for (int x = 0; x < mapSize; x++)
-        {
-            for (int y = 0; y < mapSize; y++)
-            {
-                MapTile tile = mapData.GetTile(x, y);
-                if (tile != null)
-                {
-                    CreateTileVisualization(x, y, tile, mapContainer.transform);
-                }
-            }
-        }
-
-        Debug.Log($"✅ Created simple cube visualization with {mapSize * mapSize} tiles");
-    }
-
-    /// <summary>
-    /// Create a simple cube to represent a tile
-    /// </summary>
-    private void CreateTileVisualization(int x, int y, MapTile tile, Transform parent)
-    {
-        // Create a cube for the tile
-        GameObject tileObj = GameObject.CreatePrimitive(PrimitiveType.Cube);
-        tileObj.name = $"Tile_{x}_{y}";
-        tileObj.transform.parent = parent;
-        tileObj.transform.position = new Vector3(x, 0, y);
-        tileObj.transform.localScale = new Vector3(0.9f, 0.1f, 0.9f); // Flat tiles
-
-        // Get the renderer to change colors
-        Renderer renderer = tileObj.GetComponent<Renderer>();
-        if (renderer != null)
-        {
-            // Color based on terrain type
-            Color terrainColor = GetTerrainColor(tile.terrainType);
-            renderer.material.color = terrainColor;
-        }
-
-        // Add feature visualization on top if needed
-        if (tile.featureType != FeatureType.None)
-        {
-            CreateFeatureVisualization(x, y, tile, tileObj.transform);
-        }
-    }
-
-    /// <summary>
-    /// Create feature visualization (towns, villages, roads)
-    /// </summary>
-    private void CreateFeatureVisualization(int x, int y, MapTile tile, Transform tileParent)
-    {
-        GameObject featureObj = null;
-
-        switch (tile.featureType)
-        {
-            case FeatureType.Town:
-                featureObj = GameObject.CreatePrimitive(PrimitiveType.Cylinder);
-                featureObj.name = $"Town_{x}_{y}";
-                featureObj.transform.localScale = new Vector3(0.6f, 0.5f, 0.6f);
-                featureObj.GetComponent<Renderer>().material.color = Color.blue;
-                break;
-
-            case FeatureType.Village:
-                featureObj = GameObject.CreatePrimitive(PrimitiveType.Cylinder);
-                featureObj.name = $"Village_{x}_{y}";
-                featureObj.transform.localScale = new Vector3(0.4f, 0.3f, 0.4f);
-                featureObj.GetComponent<Renderer>().material.color = Color.cyan;
-                break;
-
-            case FeatureType.Road:
-                featureObj = GameObject.CreatePrimitive(PrimitiveType.Cube);
-                featureObj.name = $"Road_{x}_{y}";
-                featureObj.transform.localScale = new Vector3(0.8f, 0.05f, 0.8f);
-                featureObj.GetComponent<Renderer>().material.color = Color.yellow;
-                break;
-        }
-
-        if (featureObj != null)
-        {
-            featureObj.transform.parent = tileParent;
-            featureObj.transform.localPosition = new Vector3(0, 0.6f, 0); // On top of tile
-        }
-    }
-
-    /// <summary>
-    /// Get color for terrain type
-    /// </summary>
-    private Color GetTerrainColor(TerrainType terrainType)
-    {
-        return terrainType switch
-        {
-            TerrainType.Plains => Color.green,
-            TerrainType.Forest => new Color(0f, 0.5f, 0f), // Dark green
-            TerrainType.Mountain => Color.gray,
-            TerrainType.Ocean => Color.blue,
-            TerrainType.Lake => new Color(0f, 0.5f, 1f), // Light blue
-            TerrainType.River => Color.cyan,
-            _ => Color.white
-        };
-    }
-
-    /// <summary>
-    /// Get the current map data
-    /// </summary>
-    public MapData GetMapData()
-    {
-        return mapData;
-    }
-
-    /// <summary>
-    /// Get the team marker transform
-    /// </summary>
-    public Transform GetTeamMarker()
-    {
-        return teamMarker;
-    }
-}

+ 220 - 10
Assets/Scripts/MapMaker2/Visualization/MMCameraController.cs

@@ -6,28 +6,212 @@ public class MMCameraController : MonoBehaviour
     public float moveSpeed = 10f;
     public float zoomSpeed = 5f;
     public float minZoom = 2f;
-    public float maxZoom = 80f;
+    public float maxZoom = 200f; // Increased for better map overview
+
+    [Header("Team Marker Focus")]
+    public KeyCode centerOnTeamKey = KeyCode.C;
+    public KeyCode zoomToFullMapKey = KeyCode.F;
+    public float focusZoomLevel = 10f;
+    public float centeringSpeed = 2f;
 
     private Camera cam;
     private Vector3 lastMousePosition;
+    private Vector3 targetPosition;
+    private float targetZoom;
+    private bool isMovingToTarget = false;
+    private SimpleTeamPlacement teamPlacement;
 
     void Start()
     {
         cam = GetComponent<Camera>();
         if (cam == null)
             cam = Camera.main;
+
+        // Set up camera for top-down view
+        cam.orthographic = true; // Ensure camera is in orthographic mode for top-down view
+
+        // Position camera above the map center, looking down
+        float mapCenterX = 0f;
+        float mapCenterZ = 0f;
+        float cameraHeight = 50f; // High above the map
+
+        // Try to get map size from MapMaker2 to center properly
+        var mapMaker = FindFirstObjectByType<MapMaker2>();
+        if (mapMaker != null)
+        {
+            var mapData = mapMaker.GetMapData();
+            if (mapData != null)
+            {
+                mapCenterX = mapData.Width / 2f;
+                mapCenterZ = mapData.Height / 2f;
+                cameraHeight = Mathf.Max(mapData.Width, mapData.Height) * 0.7f; // Scale height with map size
+            }
+        }
+
+        transform.position = new Vector3(mapCenterX, cameraHeight, mapCenterZ);
+
+        // Set camera to look straight down at the map (90 degrees on X-axis)
+        transform.rotation = Quaternion.Euler(90f, 0f, 0f);
+
+        // Set orthographic size to show a good portion of the map
+        if (cam.orthographic)
+        {
+            cam.orthographicSize = Mathf.Max(20f, cameraHeight * 0.3f);
+        }
+
+        // Initialize target values
+        targetPosition = transform.position;
+        targetZoom = cam.orthographicSize;
+
+        // Find team placement component
+        teamPlacement = FindFirstObjectByType<SimpleTeamPlacement>();
+
+        Debug.Log($"🎥 Camera initialized: Position={transform.position}, Rotation={transform.rotation.eulerAngles}, OrthographicSize={cam.orthographicSize}, Mode={(cam.orthographic ? "Orthographic" : "Perspective")}");
     }
 
     void Update()
     {
-        HandleMovement();
-        HandleZoom();
-        HandleMouseDrag();
+        // Handle team marker centering
+        if (Input.GetKeyDown(centerOnTeamKey))
+        {
+            CenterOnTeamMarker();
+        }
+
+        // Handle zoom to full map
+        if (Input.GetKeyDown(zoomToFullMapKey))
+        {
+            ZoomToFullMap();
+        }
+
+        // Handle smooth movement to target
+        if (isMovingToTarget)
+        {
+            transform.position = Vector3.Lerp(transform.position, targetPosition, Time.deltaTime * centeringSpeed);
+            cam.orthographicSize = Mathf.Lerp(cam.orthographicSize, targetZoom, Time.deltaTime * centeringSpeed);
+
+            // Check if we're close enough to stop moving
+            if (Vector3.Distance(transform.position, targetPosition) < 0.1f &&
+                Mathf.Abs(cam.orthographicSize - targetZoom) < 0.1f)
+            {
+                isMovingToTarget = false;
+            }
+        }
+        else
+        {
+            // Normal camera controls
+            HandleMovement();
+            HandleZoom();
+            HandleMouseDrag();
+        }
 
         // Help find ForestRiver tiles
-        if (Input.GetKeyDown(KeyCode.F))
+        if (Input.GetKeyDown(KeyCode.H))
         {
-            Debug.Log("💡 TIP: Look for blue-green colored tiles - those are ForestRiver tiles where rivers flow through forests!");
+            Debug.Log("💡 Camera Controls:\n" +
+                     $"- {centerOnTeamKey}: Center on team marker (preserves zoom)\n" +
+                     $"- {zoomToFullMapKey}: Zoom to full map\n" +
+                     "- WASD/Arrows: Move camera\n" +
+                     $"- Mouse wheel: Zoom (range: {minZoom}-{maxZoom})\n" +
+                     "- Middle mouse: Drag\n" +
+                     "- R: Place team randomly (if needed)\n" +
+                     "- F: Look for blue-green ForestRiver tiles");
+        }
+    }
+
+    /// <summary>
+    /// Center the camera on the team marker position
+    /// </summary>
+    public void CenterOnTeamMarker()
+    {
+        if (teamPlacement == null)
+        {
+            teamPlacement = FindFirstObjectByType<SimpleTeamPlacement>();
+        }
+
+        if (teamPlacement != null && teamPlacement.IsTeamPlaced())
+        {
+            GameObject teamMarker = teamPlacement.GetTeamMarker();
+            if (teamMarker != null)
+            {
+                Vector3 teamPos = teamMarker.transform.position;
+
+                // Set target position to center on team marker (keep Y position for camera height)
+                // For top-down view: X and Z are the map coordinates, Y is camera height
+                targetPosition = new Vector3(teamPos.x, transform.position.y, teamPos.z);
+                // Keep current zoom level instead of changing to focusZoomLevel
+                targetZoom = cam.orthographicSize;
+                isMovingToTarget = true;
+
+                Debug.Log($"🎯 Centering camera on team marker at position: {teamPos}");
+            }
+            else
+            {
+                Debug.LogWarning("⚠️ Team marker object not found! Team may not be properly placed.");
+
+                // Try to find team marker by name as backup
+                GameObject foundMarker = GameObject.Find("TeamMarker");
+                if (foundMarker != null)
+                {
+                    Vector3 teamPos = foundMarker.transform.position;
+                    targetPosition = new Vector3(teamPos.x, transform.position.y, teamPos.z);
+                    targetZoom = cam.orthographicSize;
+                    isMovingToTarget = true;
+                    Debug.Log($"🎯 Found team marker by name, centering at: {teamPos}");
+                }
+                else
+                {
+                    Debug.LogError("❌ Could not find team marker by name either!");
+                }
+            }
+        }
+        else
+        {
+            Debug.LogWarning("⚠️ Team placement not found or team not placed! Try pressing R to place team first.");
+        }
+    }
+
+    /// <summary>
+    /// Zoom out to show the entire map
+    /// </summary>
+    public void ZoomToFullMap()
+    {
+        MapData mapData = null;
+        float tileSize = 1f;
+
+        // Try to find MapMaker2 first
+        MapMaker2 mapMaker = FindFirstObjectByType<MapMaker2>();
+        if (mapMaker != null)
+        {
+            mapData = mapMaker.GetMapData();
+
+            // Get the MapVisualizer to account for tile scaling
+            MapVisualizer mapVisualizer = FindFirstObjectByType<MapVisualizer>();
+            tileSize = mapVisualizer != null ? mapVisualizer.tileSize : 1f;
+        }
+
+        if (mapData != null)
+        {
+            // Calculate map center accounting for tile size
+            targetPosition = new Vector3(
+                (mapData.Width * tileSize) / 2f,
+                transform.position.y,
+                (mapData.Height * tileSize) / 2f
+            );
+
+            // Calculate required zoom to fit entire map
+            float mapHeight = mapData.Height * tileSize;
+            float mapWidth = mapData.Width * tileSize;
+            float mapSize = Mathf.Max(mapWidth, mapHeight);
+            targetZoom = (mapSize / 2f) + 5f; // Add padding for better view
+            targetZoom = Mathf.Clamp(targetZoom, minZoom, maxZoom);
+
+            isMovingToTarget = true;
+
+            Debug.Log($"🗺️ Zooming to full map: Size {mapData.Width}x{mapData.Height}, TileSize: {tileSize}, WorldSize: {mapWidth:F1}x{mapHeight:F1}, Zoom: {targetZoom}");
+        }
+        else
+        {
+            Debug.LogWarning("⚠️ No MapMaker2 component found!");
         }
     }
 
@@ -36,8 +220,16 @@ public class MMCameraController : MonoBehaviour
         float horizontal = Input.GetAxis("Horizontal");
         float vertical = Input.GetAxis("Vertical");
 
-        Vector3 movement = new Vector3(horizontal, vertical, 0) * moveSpeed * Time.deltaTime;
-        transform.Translate(movement);
+        if (horizontal != 0 || vertical != 0)
+        {
+            // For top-down view: horizontal = X movement, vertical = Z movement
+            Vector3 movement = new Vector3(horizontal, 0, vertical) * moveSpeed * Time.deltaTime;
+            transform.Translate(movement, Space.World); // Use world space for consistent movement
+
+            // Stop automatic movement to target if user is manually controlling
+            isMovingToTarget = false;
+            targetPosition = transform.position;
+        }
     }
 
     private void HandleZoom()
@@ -45,8 +237,22 @@ public class MMCameraController : MonoBehaviour
         float scroll = Input.GetAxis("Mouse ScrollWheel");
         if (scroll != 0)
         {
-            cam.orthographicSize -= scroll * zoomSpeed;
-            cam.orthographicSize = Mathf.Clamp(cam.orthographicSize, minZoom, maxZoom);
+            float oldSize = cam.orthographicSize;
+            float newSize = cam.orthographicSize - scroll * zoomSpeed;
+            newSize = Mathf.Clamp(newSize, minZoom, maxZoom);
+            cam.orthographicSize = newSize;
+
+            // Debug log to check zoom limits
+            if (newSize >= maxZoom - 0.1f || newSize <= minZoom + 0.1f)
+            {
+                Debug.Log($"🔍 Zoom limit reached: {newSize:F1} (min: {minZoom}, max: {maxZoom})");
+            }
+
+            // Update target zoom if we're not moving to a target
+            if (!isMovingToTarget)
+            {
+                targetZoom = newSize;
+            }
         }
     }
 
@@ -63,6 +269,10 @@ public class MMCameraController : MonoBehaviour
             Vector3 worldDelta = cam.ScreenToWorldPoint(delta) - cam.ScreenToWorldPoint(Vector3.zero);
             transform.position -= worldDelta;
             lastMousePosition = Input.mousePosition;
+
+            // Stop automatic movement to target if user is manually controlling
+            isMovingToTarget = false;
+            targetPosition = transform.position;
         }
     }
 }

+ 24 - 6
Assets/Scripts/MapMaker2/Visualization/MapVisualizer.cs

@@ -145,8 +145,20 @@ public class MapVisualizer : MonoBehaviour
                 float requiredHeight = mapHeight / 2f;
                 float requiredWidth = mapWidth / (2f * aspectRatio);
 
-                // Increased the padding and base size for better zoom out capability
-                mainCam.orthographicSize = Mathf.Max(requiredHeight, requiredWidth, 80f) + 20f;
+                // Calculate required size but don't override if camera is already zoomed out further
+                float suggestedSize = Mathf.Max(requiredHeight, requiredWidth) + 20f;
+
+                // Only set the camera size if it's smaller than what we need
+                // This preserves user's zoom level while ensuring the map is initially visible
+                if (mainCam.orthographicSize < suggestedSize)
+                {
+                    mainCam.orthographicSize = suggestedSize;
+                    Debug.Log($"🎥 Camera zoom adjusted to fit map: {suggestedSize:F1}");
+                }
+                else
+                {
+                    Debug.Log($"🎥 Camera zoom preserved: {mainCam.orthographicSize:F1} (suggested: {suggestedSize:F1})");
+                }
             }
         }
     }
@@ -169,14 +181,14 @@ public class MapVisualizer : MonoBehaviour
                 // Convert visible coordinates to world coordinates
                 Vector3 worldPos = new Vector3(
                     (bounds.x + visiblePos.x) * tileSize,
-                    (bounds.y + visiblePos.y) * tileSize,
-                    0
+                    0,
+                    (bounds.y + visiblePos.y) * tileSize
                 );
 
                 // Debug log for the first few tiles to verify positioning
                 if (visiblePos.x < 3 && visiblePos.y < 3)
                 {
-                    Debug.Log($"🔧 Tile positioning: visible({visiblePos.x}, {visiblePos.y}) + bounds({bounds.x}, {bounds.y}) → world({worldPos.x:F1}, {worldPos.y:F1})");
+                    Debug.Log($"🔧 Tile positioning: visible({visiblePos.x}, {visiblePos.y}) + bounds({bounds.x}, {bounds.y}) → world({worldPos.x:F1}, {worldPos.z:F1})");
                 }
 
                 return worldPos;
@@ -184,7 +196,7 @@ public class MapVisualizer : MonoBehaviour
         }
 
         // Fallback to direct positioning for non-exploration mode
-        return new Vector3(visiblePos.x * tileSize, visiblePos.y * tileSize, 0);
+        return new Vector3(visiblePos.x * tileSize, 0, visiblePos.y * tileSize);
     }
 
     private void ClearOutOfBoundsTiles(MapData mapData)
@@ -248,6 +260,9 @@ public class MapVisualizer : MonoBehaviour
             // Scale the tile to make it visible
             tileObject.transform.localScale = Vector3.one * tileSize;
 
+            // Rotate sprite to be flat on the ground for top-down view
+            tileObject.transform.rotation = Quaternion.Euler(90f, 0f, 0f);
+
             terrainTiles[pos] = tileObject;
         }
         else
@@ -302,6 +317,9 @@ public class MapVisualizer : MonoBehaviour
             // Scale the tile to make it visible
             featureObject.transform.localScale = Vector3.one * tileSize;
 
+            // Rotate sprite to be flat on the ground for top-down view
+            featureObject.transform.rotation = Quaternion.Euler(90f, 0f, 0f);
+
             featureTiles[pos] = featureObject;
         }
         else

+ 83 - 0
CAMERA_FIXES_SUMMARY.md

@@ -0,0 +1,83 @@
+# Camera Issues Fixed
+
+## Issues Addressed
+
+### ✅ **Issue 1: Camera doesn't focus on TeamMarker GameObject**
+**Problem**: Team marker centering was changing zoom level instead of preserving it.
+**Fix**: Modified `CenterOnTeamMarker()` to preserve current zoom level:
+```csharp
+// Before: targetZoom = focusZoomLevel;
+// After: targetZoom = cam.orthographicSize; // Keep current zoom
+```
+**Added**: Better error handling with fallback to find team marker by name if normal method fails.
+
+### ✅ **Issue 2: Full map view makes camera move around so nothing is visible**
+**Problem**: Full map positioning wasn't accounting for tile scaling.
+**Fix**: Updated `ZoomToFullMap()` to properly use `MapVisualizer.tileSize`:
+```csharp
+// Before: Simple map dimensions without scaling
+targetPosition = new Vector3(mapData.Width / 2f, y, mapData.Height / 2f);
+
+// After: Proper world coordinates with tile scaling
+targetPosition = new Vector3(
+    (mapData.Width * tileSize) / 2f,
+    transform.position.y,
+    (mapData.Height * tileSize) / 2f
+);
+```
+
+### ✅ **Issue 3: Max zoom still limited to 80 with scroll wheel**
+**Problem**: `MapVisualizer.PositionCameraToMap()` was overriding camera zoom settings.
+**Fix**: Modified MapVisualizer to preserve user's zoom level:
+```csharp
+// Before: Always set camera size
+mainCam.orthographicSize = Mathf.Max(requiredHeight, requiredWidth, 80f) + 20f;
+
+// After: Only adjust if camera zoom is too small
+if (mainCam.orthographicSize < suggestedSize) {
+    mainCam.orthographicSize = suggestedSize;
+}
+```
+**Added**: Debug logging to track zoom limit behavior.
+
+### ✅ **Issue 4: Zoom level changes when centering team marker**
+**Problem**: Centering was forcing a specific zoom level.
+**Fix**: Changed to preserve current camera zoom level when centering on team marker.
+
+## Additional Improvements
+
+### 🔧 **Enhanced Error Handling**
+- Better debugging messages for team marker issues
+- Fallback mechanism to find team marker by name
+- Clear instructions for user (press R to place team)
+
+### 🔧 **Improved Help System**
+- Updated help text to show actual zoom range
+- Added mention of team placement controls
+- Clarified that centering preserves zoom
+
+### 🔧 **Better Coordinate Handling**
+- Proper tile size scaling for world coordinates
+- Accurate map center calculation
+- Respect for exploration system coordinate transformations
+
+## How to Test
+
+1. **Team Marker Centering**: 
+   - Place team marker (press R if needed)
+   - Set any zoom level you like
+   - Press C - camera should center on team marker WITHOUT changing zoom
+
+2. **Full Map View**:
+   - Press F - camera should smoothly move to show entire map
+   - Map should be properly centered and visible
+
+3. **Enhanced Zoom Range**:
+   - Use mouse wheel - should now zoom out to maxZoom (200) instead of being stuck at 80
+   - Zoom range should be 2-200 as configured
+
+4. **Preserved Settings**:
+   - Manual camera movement should stop automatic movement
+   - User zoom settings should be preserved across map regeneration
+
+All fixes are in the MMCameraController.cs and MapVisualizer.cs files. The camera system should now work smoothly without the reported issues.

+ 117 - 0
IMPLEMENTATION_SUMMARY.md

@@ -0,0 +1,117 @@
+# Team Marker Camera Implementation Summary
+
+## What Was Implemented
+
+### ✅ Camera Centering on Team Marker
+- **Enhanced MapCameraController**: Added team marker centering functionality
+- **Enhanced MMCameraController**: Added team marker centering functionality  
+- **New TeamMarkerCameraController**: Universal component for any camera
+- **Hotkey**: Press `C` to center camera on team marker
+- **Smart Positioning**: Automatically positions camera above team marker with optimal zoom level
+
+### ✅ Enhanced Zoom for Full Map View
+- **Increased Zoom Range**: 
+  - MapCameraController: `maxZoom` increased from 50 to 100
+  - MMCameraController: `maxZoom` increased from 80 to 200
+  - TeamMarkerCameraController: Configurable up to 300
+- **Full Map Hotkey**: Press `F` to zoom out and show entire map
+- **Smart Map Sizing**: Automatically calculates optimal zoom level to fit the entire map
+
+### ✅ Improved User Experience
+- **Smooth Camera Movement**: All movements are smoothly animated
+- **Manual Override**: User can take control during automatic movements
+- **Help System**: Press `H` to see available controls
+- **Auto-Center Option**: Optionally auto-center on team marker when first placed
+
+## Files Created/Modified
+
+### New Files Created:
+1. **`Assets/Scripts/Camera/TeamMarkerCameraController.cs`**
+   - Universal camera component for team marker functionality
+   - Can be attached to any camera
+   - Most feature-complete implementation
+
+2. **`Assets/Scripts/Debug/TeamMarkerCameraTest.cs`**
+   - Test script to verify camera functionality
+   - Helps debug camera and team marker issues
+
+3. **`TEAM_MARKER_CAMERA_GUIDE.md`**
+   - Complete documentation and usage guide
+   - Implementation instructions
+   - Troubleshooting guide
+
+### Enhanced Existing Files:
+1. **`Assets/Scripts/BattleFieldMaker/MapCameraController.cs`**
+   - Added team marker centering: `CenterOnTeamMarker()`
+   - Added full map zoom: `ZoomToFullMap()`
+   - Increased max zoom range to 100
+   - Added help system
+
+2. **`Assets/Scripts/MapMaker2/Visualization/MMCameraController.cs`**
+   - Added team marker centering: `CenterOnTeamMarker()`
+   - Added full map zoom: `ZoomToFullMap()`
+   - Increased max zoom range to 200
+   - Added smooth movement system
+   - Enhanced user input handling
+
+## How to Use
+
+### Immediate Usage (Existing Controllers)
+If you already have `MapCameraController` or `MMCameraController` in your scene:
+- **Press `C`** to center on team marker
+- **Press `F`** to zoom to full map  
+- **Press `H`** for help
+
+### Recommended Setup (Universal Component)
+1. Add `TeamMarkerCameraController` component to your main camera
+2. Configure settings in inspector as needed
+3. Component will automatically work with your team marker
+
+### Testing
+1. Add `TeamMarkerCameraTest` component to any GameObject
+2. **Press `T`** to run all tests
+3. Check console for results and troubleshooting info
+
+## Key Features
+
+### 🎯 Smart Team Marker Detection
+- Automatically finds `SimpleTeamPlacement` component
+- Works with both exploration and non-exploration modes
+- Handles coordinate system conversions automatically
+
+### 🗺️ Intelligent Map Sizing
+- Automatically detects map dimensions from `MapMaker2`
+- Calculates optimal zoom level for full map view
+- Supports maps of any size
+
+### 🎮 Enhanced Controls
+- **Hotkeys**: `C` (center), `F` (full map), `H` (help)
+- **Smooth Animation**: All camera movements are smoothly interpolated
+- **Manual Override**: User input stops automatic movement
+- **Configurable**: All settings can be adjusted in inspector
+
+### 🔧 Robust Integration
+- **Non-Breaking**: Enhanced existing controllers without breaking changes
+- **Modular**: Universal component can be added to any camera
+- **Compatible**: Works with existing camera movement and zoom systems
+- **UI-Aware**: Respects UI boundaries where implemented
+
+## Configuration Options
+
+### TeamMarkerCameraController Settings:
+- `centerOnTeamKey`: Key to center on team (default: C)
+- `zoomToFullMapKey`: Key to zoom to full map (default: F)
+- `centeringSpeed`: Speed of camera animations (default: 2)
+- `focusZoomLevel`: Zoom level when focusing on team (default: 15)
+- `maxZoomOut`: Maximum zoom out level (default: 200)
+- `autoCenterOnTeamPlacement`: Auto-center when team placed (default: true)
+- `autoCenterDelay`: Delay before auto-center (default: 2s)
+
+## Next Steps
+
+1. **Test the Implementation**: Use the test script to verify everything works
+2. **Add to Your Camera**: Attach `TeamMarkerCameraController` to your main camera
+3. **Configure Settings**: Adjust zoom levels and speeds as needed
+4. **Test with Your Map**: Verify it works with your specific map size and setup
+
+The implementation is complete and ready to use! The camera will now smoothly center on your team marker and provide enhanced zoom capabilities for better map navigation.

+ 0 - 91
SIMPLE_MAPMAKER_GUIDE.md

@@ -1,91 +0,0 @@
-# Simple MapMaker2 Setup Guide
-
-This is a clean, simplified version of MapMaker2 without exploration/expansion systems.
-Just basic map generation with team placement on towns/villages.
-
-## Quick Setup
-
-### 1. Replace Current MapMaker2
-- Disable or remove the complex MapMaker2 component
-- Add `SimpleMapMaker2` component to your map GameObject
-
-### 2. Setup SimpleTravelUI
-- Create a GameObject with `SimpleTravelUI` component
-- Assign a UIDocument component to it
-- The UI will be created programmatically (no UXML needed)
-
-### 3. Setup Click Handling
-- Add `SimpleMapClickHandler` component to a GameObject
-- Assign references:
-  - mapMaker: Your SimpleMapMaker2 component
-  - travelUI: Your SimpleTravelUI component
-  - mapCamera: Your map camera (or leave null for Camera.main)
-
-### 4. Team Marker
-- Create a simple GameObject for the team marker (sphere, cube, etc.)
-- Name it "TeamMarker"
-- Or assign a prefab to SimpleMapMaker2.teamMarkerPrefab
-
-## How It Works
-
-### Map Generation
-- Creates a 100x100 map by default
-- Simple terrain: Grassland, Forest, Hills, Mountains
-- Basic road network (cross pattern)
-- Several towns and villages placed strategically
-
-### Team Placement
-- Team marker automatically placed on first town/village found
-- Use context menu "Move Team to Random Town" to relocate
-
-### Travel System
-- Click on any town or village to show travel UI
-- Simple travel interface shows destination and distance
-- Click "Travel" to instantly move team marker
-- No complex routing - just direct movement
-
-## Context Menu Options
-
-### SimpleMapMaker2
-- "Generate New Map": Creates new map with random seed
-- "Move Team to Random Town": Moves team to different settlement
-
-### SimpleMapClickHandler
-- "Test Click at Center": Test click functionality at map center
-
-### SimpleTravelUI
-- "Test Travel UI": Show travel UI with test data
-
-## Benefits of This Simple Version
-
-✅ **No Coordinate Conversion Issues** - Direct 1:1 map to world coordinates
-✅ **No Complex Exploration System** - Just basic map and travel
-✅ **No Click-Through Problems** - Simple UI without background blockers
-✅ **Easy to Understand** - Clear, straightforward code
-✅ **Quick Setup** - Minimal configuration required
-✅ **Reliable** - No complex systems to break
-
-## Map Layout
-
-The default map includes:
-- Towns at corners: (25,25), (75,25), (25,75), (75,75)
-- Center town at (50,50)
-- Villages at (30,60), (70,40)
-- Cross-shaped road network
-- Random terrain distribution
-
-## Customization
-
-### Map Size
-Change `mapSize` in SimpleMapMaker2 (default: 100)
-
-### Settlements
-Modify `settlementPositions` array in `AddSettlements()` method
-
-### Terrain
-Adjust noise parameters in `CreateBasicMapData()` method
-
-### Team Marker
-Assign custom prefab to `teamMarkerPrefab` field
-
-This simple system provides a solid foundation that you can build upon incrementally.

+ 115 - 0
TEAM_MARKER_CAMERA_GUIDE.md

@@ -0,0 +1,115 @@
+# Team Marker Camera Control System
+
+This system provides enhanced camera controls for centering on the team marker and managing map overview in your RPG game.
+
+## Features
+
+### 🎯 Team Marker Centering
+- **Hotkey**: Press `C` to center the camera on the team marker
+- **Auto-Focus**: Automatically zooms to a comfortable level when centering
+- **Auto-Center**: Optionally auto-centers when the team marker is first placed
+
+### 🗺️ Full Map Overview
+- **Hotkey**: Press `F` to zoom out and show the entire map
+- **Smart Sizing**: Automatically calculates the best zoom level to fit the whole map
+- **Increased Zoom Range**: Enhanced zoom-out capability for large maps
+
+### 🎮 Enhanced Controls
+- **Smooth Movement**: All camera movements are smoothly animated
+- **Manual Override**: User can take manual control during automatic movements
+- **Help System**: Press `H` to see available controls
+
+## Implementation
+
+### Method 1: Enhanced Existing Controllers
+
+The following camera controllers have been enhanced with team marker functionality:
+
+#### MapCameraController (BattleFieldMaker)
+- Enhanced for battlefield/map scenes
+- Respects UI boundaries (doesn't interfere with side panels)
+- Default hotkeys: `C` (center), `F` (full map), `H` (help)
+
+#### MMCameraController (MapMaker2)
+- Enhanced for MapMaker2 scenes  
+- Full camera control with mouse drag support
+- Default hotkeys: `C` (center), `F` (full map), `H` (help)
+
+### Method 2: Universal Component (Recommended)
+
+#### TeamMarkerCameraController
+A universal component that can be attached to any camera to provide team marker functionality.
+
+**Usage:**
+1. Add the `TeamMarkerCameraController` script to your main camera
+2. Configure the settings in the inspector
+3. The component will automatically find the team marker and provide controls
+
+**Key Settings:**
+- `centerOnTeamKey`: Key to center on team marker (default: C)
+- `zoomToFullMapKey`: Key to zoom to full map (default: F)
+- `centeringSpeed`: Speed of camera animations (default: 2)
+- `focusZoomLevel`: Zoom level when focusing on team (default: 15)
+- `maxZoomOut`: Maximum zoom out for full map (default: 200)
+- `autoCenterOnTeamPlacement`: Auto-center when team is placed (default: true)
+
+## Hotkeys Summary
+
+| Key | Action | Description |
+|-----|--------|-------------|
+| `C` | Center on Team | Centers camera on team marker with comfortable zoom |
+| `F` | Full Map View | Zooms out to show entire map |
+| `H` | Show Help | Displays available controls in console |
+| Mouse Wheel | Zoom | Standard zoom in/out |
+| WASD/Arrows | Move | Manual camera movement (where supported) |
+| Middle Mouse | Drag | Drag camera around (where supported) |
+
+## Integration with Existing Systems
+
+### Team Placement Integration
+- Automatically detects `SimpleTeamPlacement` component
+- Works with both exploration and non-exploration modes
+- Handles coordinate system conversions automatically
+
+### Map System Integration
+- Compatible with `MapMaker2`
+- Automatically detects map dimensions for full map view
+- Works with both static and dynamically generated maps
+
+### UI Integration
+- Respects UI panel boundaries in `MapCameraController`
+- Doesn't interfere with existing UI systems
+- Can be easily enabled/disabled as needed
+
+## Troubleshooting
+
+### "Team marker not found" Warning
+- Ensure `SimpleTeamPlacement` component exists in the scene
+- Check that the team has been placed (call `RandomlyPlaceTeam()` if needed)
+- Verify the team marker GameObject exists and is active
+
+### Camera Not Moving
+- Check that the camera has the enhanced controller script attached
+- Ensure the script is enabled and not conflicting with other camera scripts
+- Verify hotkeys are not being captured by other systems
+
+### Zoom Levels
+- Adjust `maxZoom` in camera controllers for larger zoom range
+- Modify `focusZoomLevel` for preferred team marker focus distance
+- Use `maxZoomOut` in `TeamMarkerCameraController` to limit maximum zoom
+
+## Performance Notes
+
+- All camera movements use smooth interpolation for better UX
+- Automatic movement stops when target is reached to save performance
+- Manual controls override automatic movement to prevent conflicts
+- Component automatically finds required references at startup
+
+## Future Enhancements
+
+Possible future improvements:
+- Save/restore camera positions
+- Multiple preset camera positions
+- Follow mode for team marker during movement
+- Minimap integration
+- Custom zoom curves for different map sizes