/// <summary>
 /// Processes the input for the wall tool.
 /// </summary>
 void ProcessInputForWallTool()
 {
     if (dragInitiated)
     {
         bool    completed = Input.GetMouseButtonUp(0);
         Vector2 begin     = SnapToGrid(canvas.InverseTransformPoint(mouseDownPos));
         Vector2 end       = SnapToGrid(canvas.InverseTransformPoint(Input.mousePosition));
         floorController.CreateWall(begin, end, !completed);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Overwrites this floor's content with JSON object root.
        /// </summary>
        /// <param name = "api">The FloorController.</param>
        /// <param name="root">Root.</param>
        public void FromJSON(FloorController api, JSONNode root)
        {
            if (root == null)
            {
                return;
            }

            floorId    = root["floor_id"];
            floorName  = root["floor_name"];
            floorOrder = root["floor_order"];
            libraryId  = root["library"];

            if (api == null)
            {
                // Not ready to expand yet!
                floorJSONCache = root.ToString();
                return;
            }

            aisles.Clear();
            aisleAreas.Clear();
            walls.Clear();
            landmarks.Clear();

            foreach (JSONObject obj in root["aisles"].AsArray)
            {
                Aisle aisle = api.CreateAisle(Rect.zero, false, true);
                aisle.FromJSON(api, obj);
            }

            foreach (JSONObject obj in root["aisle_areas"].AsArray)
            {
                AisleArea aisleArea = api.CreateAisleArea(Rect.zero, false, true);
                aisleArea.FromJSON(api, obj);
            }

            foreach (JSONObject obj in root["walls"].AsArray)
            {
                Wall wall = api.CreateWall(Vector2.zero, Vector2.zero, false, true);
                wall.FromJSON(api, obj);
            }

            foreach (JSONObject obj in root["landmarks"].AsArray)
            {
                Landmark landmark = api.CreateLandmark(Rect.zero, false, true);
                landmark.FromJSON(api, obj);
            }
        }