浏览代码

调好了L14中间位置,右上角部分位置是不是kimi瞎搞了

Void_F 9 月之前
父节点
当前提交
744a3ef9c4
共有 3 个文件被更改,包括 28 次插入16 次删除
  1. 19 5
      Assets/MapGenerator.cs
  2. 1 3
      Assets/MapLodCtrl.cs
  3. 8 8
      Assets/Prefabs/MiniMap.prefab

+ 19 - 5
Assets/MapGenerator.cs

@@ -15,6 +15,15 @@ public class MapGenerator : MonoBehaviour
 
     private bool isInit = false;
     private bool isShow = false;
+    public bool initDone = false;
+
+    public void InitMap()
+    {
+        if (!isInit)
+        {
+            StartCoroutine(CreatMap(false));
+        }
+    }
 
     public void ShowMap()
     {
@@ -23,7 +32,7 @@ public class MapGenerator : MonoBehaviour
             isShow = true;
             if (!isInit)
             {
-                StartCoroutine(CreatMap());
+                StartCoroutine(CreatMap(true));
             }
             else
             {
@@ -47,25 +56,30 @@ public class MapGenerator : MonoBehaviour
         }
     }
 
-    private IEnumerator CreatMap()
+    private IEnumerator CreatMap(bool showQuad=false)
     {
-        WaitForSeconds wait = new WaitForSeconds(0.01f);
         isInit = true;
+        WaitForSeconds wait = new WaitForSeconds(0.01f);
         for (int i = 0; i < x_Count; i++)
         {
             for (int j = 0; j < y_Count; j++)
             {
-                GeneratorQuad(i, j, new Vector2(1, 1));
+                GeneratorQuad(i, j, new Vector2(1, 1),showQuad);
             }
 
             yield return wait;
         }
+        initDone = true;
     }
 
-    private void GeneratorQuad(int _x, int _y, Vector2 _size)
+    private void GeneratorQuad(int _x, int _y, Vector2 _size,bool showQuad)
     {
         string texName = $"{nameHeard}{_x}_{_y}";
         GameObject tempQuad = new GameObject(texName);
+        if (!isShow||showQuad == false)
+        {
+            tempQuad.SetActive(false);
+        }
         MeshFilter meshFilter = tempQuad.AddComponent<MeshFilter>();
         MeshRenderer meshRenderer = tempQuad.AddComponent<MeshRenderer>();
         Material tempMat = new Material(Shader.Find("Unlit/Texture"));

+ 1 - 3
Assets/MapLodCtrl.cs

@@ -8,7 +8,7 @@ public class MapLodCtrl : MonoBehaviour
     public CameraBirdSec cameraBirdSec;
 
     public List<LodLayer> MapList = new List<LodLayer>();
-    public int currentMapIndex = 0;
+    public int currentMapIndex = 2;
 
     public List<LodStayLayer> MapStayList = new List<LodStayLayer>();
     
@@ -20,8 +20,6 @@ public class MapLodCtrl : MonoBehaviour
     private void Start()
     {
         MapList[currentMapIndex].map.ShowMap();
-        //cameraBirdSec.currentDistance = MapList[currentMapIndex].cameraDistanceMax;
-        //OnCameraDistanceChange(cameraBirdSec.currentDistance);
     }
 
     private void OnDestroy()

+ 8 - 8
Assets/Prefabs/MiniMap.prefab

@@ -25,8 +25,8 @@ Transform:
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 249304407}
   m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
-  m_LocalPosition: {x: 5.8, y: -1.68, z: -0.59}
-  m_LocalScale: {x: 1.675, y: 1.675, z: 1}
+  m_LocalPosition: {x: -0.94083595, y: -2.5429688, z: -0.58984375}
+  m_LocalScale: {x: 1.6732641, y: 1.6732641, z: 0.9989637}
   m_ConstrainProportionsScale: 0
   m_Children: []
   m_Father: {fileID: 7069582396450853087}
@@ -248,8 +248,8 @@ Transform:
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 3851146091059575939}
   m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
-  m_LocalPosition: {x: -11.557151, y: -8.8046875, z: -0.4}
-  m_LocalScale: {x: 6.70695, y: 6.70695, z: 6.70695}
+  m_LocalPosition: {x: -18.28, y: -9.66, z: -0.4}
+  m_LocalScale: {x: 6.7, y: 6.7, z: 6.7}
   m_ConstrainProportionsScale: 1
   m_Children: []
   m_Father: {fileID: 7069582396450853087}
@@ -504,10 +504,10 @@ MonoBehaviour:
   - map: {fileID: 6151077931809545111}
     cameraDistanceMin: 1
     cameraDistanceMax: 9
-    min_X_Range: {x: -91.26301, y: 68.50545}
-    max_X_Range: {x: -81.78609, y: 61.82023}
-    min_Y_Range: {x: 71.28906, y: -89}
-    max_Y_Range: {x: 66.34375, y: -84.82813}
+    min_X_Range: {x: -97.90345, y: 61.69658}
+    max_X_Range: {x: -88.40508, y: 54.98404}
+    min_Y_Range: {x: 70.34375, y: -89.78125}
+    max_Y_Range: {x: 65.36328, y: -85.63672}
   - map: {fileID: 7373033485756218074}
     cameraDistanceMin: 9
     cameraDistanceMax: 50