Ejemplo n.º 1
0
 private void AutoRecord()
 {
     if (regionObj == null)
     {
         RegionDataObject reobj = ScriptableObject.CreateInstance<RegionDataObject>();
         ProjectWindowUtil.CreateAsset(reobj, "regionObj.asset");
         regionObj = reobj;
     }
     regionObj.floorDataObjs.Clear();
     foreach (Transform regionTransform in transform)
     {
         FloorData flourData = new FloorData();
         flourData.name = regionTransform.name;
         flourData.flour = regionTransform.GetSiblingIndex();
         flourData.flourHeight = regionTransform.localPosition.y;
         flourData.regionList.AddRange(LoadRegion(regionTransform));
         regionObj.floorDataObjs.Add(flourData);
     }
 }
        public OrientateController(RegionDataObject regionObj)
        {
            positions = regionObj.floorDataObjs.ToArray();
            for (int i = 0; i < positions.Length; i++)
            {
                for (int j = 0; j < positions.Length - i - 1; j++)
                {
                    if (positions[j].flour > positions[j + 1].flour)
                    {
                        FloorData temp = positions[j + 1];
                        positions[j + 1] = positions[j];
                        positions[j]     = temp;
                    }
                }
            }

            regions = new List <List <FloorData.Region> >();
            foreach (FloorData item in positions)
            {
                regions.Add(item.regionList);
            }
        }