Browse Source

uint GetInnerID()

Виктор Шейко 4 years ago
parent
commit
19f9dcbc46

+ 11 - 0
Assets/Scripts/Components/WallCreate.cs

@@ -145,6 +145,7 @@ public class WallCreate : MonoBehaviour
     {
         //var end_pos = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));
         //Debug.Log($"end_pos = {end_pos}");
+
         var location_id = player.locations_index[player.active_location];
         if (!Walls.ContainsKey(location_id)) 
             Walls[location_id] = new List<Wall>();
@@ -271,4 +272,14 @@ public class WallCreate : MonoBehaviour
     //        z.Save();
     //    }
     //}
+
+    static uint WallsGetInnerID(uint location_id)
+    {
+        return (uint) Walls[location_id].Count;
+    } 
+    
+    static uint ZonessGetInnerID(uint location_id)
+    {
+        return (uint) Zones[location_id].Count;
+    }
 }

+ 5 - 0
Assets/Scripts/Controllers/EditorController.cs

@@ -57,6 +57,10 @@ public class EditorController : MonoBehaviour
             AddBeacon(player);
         });
 
+        var random = new System.Random();
+        int number = random.Next(2000000000, Int32.MaxValue);
+        uint uintNumber = (uint)(number + (uint)Int32.MaxValue);
+
         if (NewLocation == null)
         {
             NewLocation = new GameObject();
@@ -75,6 +79,7 @@ public class EditorController : MonoBehaviour
             }
             var location = new Location
             {
+                id = uintNumber,
                 location = NewLocation,
                 walls = new List<Wall>(),
                 zones = new List<Zone>(),