public IEnumerator DoUpdate(GamingMapArea area) { Creature creature = gameObject.GetComponent <Creature>(); if (creature != null) { m_CreatureId = creature.m_Uid; } yield return(null); m_MapArea = area; teleportList = area.GetTeleportList(); //因为策划是手动挂脚本,所以得去检测 if (m_TeleportNames == null) { if (teleportList != null && teleportList.Count > 0) { m_TeleportNames = new string[teleportList.Count]; for (int iTeleport = 0; iTeleport < teleportList.Count; iTeleport++) { TeleportVO vo = teleportList[iTeleport]; if (vo == null) { continue; } m_TeleportNames[iTeleport] = vo.ID.ToString(); } } } yield return(null); }
/// <summary> /// 读取json数据 /// </summary> /// <param name="mapArea"></param> private void ReadJsonData(GamingMapArea mapArea) { if (mapArea == null) { return; } EditorGamingMap gamingMap = EditorGamingMapData.LoadGamingMapFromJson(mapArea.GetGamingMapId()); if (gamingMap != null) { EditorArea[] areas = gamingMap.areaList; if (areas != null && areas.Length > 0) { for (int iArea = 0; iArea < areas.Length; iArea++) { EditorArea area = areas[iArea]; if (area.areaId == mapArea.m_AreaId) { mapArea.Init(area, this); } } } } }
public IEnumerator OnUpdate(GamingMapArea area) { m_GamingMapArea = area; if (m_CreateTreasureEnumerator != null) { while (m_CreateTreasureEnumerator.MoveNext()) { yield return(null); } m_CreateTreasureEnumerator = null; m_EditorTreasure = null; } m_TreasureCache.Clear(); Treasure[] treasures = GetComponentsInChildren <Treasure>(); if (treasures != null && treasures.Length > 0) { m_TreasureCache.AddRange(treasures); for (int iTreasure = 0; iTreasure < m_TreasureCache.Count; iTreasure++) { IEnumerator treasureEnumerator = m_TreasureCache[iTreasure].DoUpdate(this); if (treasureEnumerator != null) { while (treasureEnumerator.MoveNext()) { yield return(null); } } } } yield return(null); }
/// <summary> /// 重置 /// </summary> public void ResetArea(GamingMapArea area) { if (area != null) { area.Clear(false); } }
public IEnumerator OnUpdate(GamingMapArea area) { m_GamingMapArea = area; if (m_CreateMineralEnumerator != null) { while (m_CreateMineralEnumerator.MoveNext()) { yield return(null); } m_CreateMineralEnumerator = null; m_EditorMinerals = null; } m_MineralCache.Clear(); Mineral[] minerals = GetComponentsInChildren <Mineral>(); if (minerals != null && minerals.Length > 0) { m_MineralCache.AddRange(minerals); for (int iMineral = 0; iMineral < m_MineralCache.Count; iMineral++) { IEnumerator mineralEnumerator = m_MineralCache[iMineral].DoUpdate(); if (mineralEnumerator != null) { while (mineralEnumerator.MoveNext()) { yield return(null); } } } } yield return(null); }
public IEnumerator OnUpdate(GamingMapArea mapArea) { m_GamingMapArea = mapArea; if (m_CreateTriggerEnumerator != null) { while (m_CreateTriggerEnumerator.MoveNext()) { yield return(null); } m_CreateTriggerEnumerator = null; m_EditorTrigger = null; } yield return(null); m_TriggerCache = gameObject.GetComponentsInChildren <Trigger>(); CalcuateMaxTriggerId(); if (m_TriggerCache != null && m_TriggerCache.Length > 0) { for (int iTrigger = 0; m_TriggerCache != null && iTrigger < m_TriggerCache.Length; iTrigger++) { IEnumerator triggerEnumerator = m_TriggerCache[iTrigger].OnUpdate(this, m_ShowModel); if (triggerEnumerator != null) { while (m_TriggerCache != null && m_TriggerCache[iTrigger] != null && triggerEnumerator.MoveNext()) { yield return(null); } } } } yield return(null); }
public void Init(TreasureRoot root) { if (root == null) { return; } m_Root = root; GamingMapArea gamingArea = root.m_GamingMapArea; if (gamingArea != null) { Area[] areas = FindObjectsOfType <Area>(); if (areas != null && areas.Length > 0) { for (int iArea = 0; iArea < areas.Length; iArea++) { Area area = areas[iArea]; if (area.Uid == gamingArea.m_AreaId) { m_Marks = area.GetSemaphoreMarks(); m_RootMark = area.m_TreasureRoot; } } } } }
/// <summary> /// 创建区域 /// </summary> /// <param name="area"></param> private GamingMapArea CreateArea(EditorArea area) { GameObject areaObj = new GameObject(); areaObj.transform.SetParent(transform); GamingMapArea mapArea = areaObj.AddComponent <GamingMapArea>(); mapArea.Init(area, this); return(mapArea); }
/// <summary> /// 保存其他GamingArea /// </summary> private void SaveOtherGamingArea() { if (m_GamingAreaList != null && m_GamingAreaList.Count > 0) { for (int iGame = 0; iGame < m_GamingAreaList.Count; iGame++) { GamingMapArea mapArea = m_GamingAreaList[iGame]; SaveGamingArea(mapArea); } } }
/// <summary> /// 删除所有GamingArea /// </summary> private void DestroyAllGamingArea() { if (m_GamingAreaList != null && m_GamingAreaList.Count > 0) { for (int iGame = 0; iGame < m_GamingAreaList.Count; iGame++) { GamingMapArea mapArea = m_GamingAreaList[iGame]; mapArea.Clear(true); } } }
public void Init(EditorTeleport[] teleports, GamingMapArea area) { m_GamingMapArea = area; m_EditorTeleport = teleports; GetTeleportList(); GetTeleportShowNames(); //m_SelectLocation = new Dictionary<int, int>(); m_SelectLocation = new List<TeleportInfo>(); if (m_EditorTeleport != null && m_EditorTeleport.Length > 0) { for (int iTeleport = 0; m_EditorTeleport != null && iTeleport < m_EditorTeleport.Length; iTeleport++) { EditorChanel[] chanelList = m_EditorTeleport[iTeleport].chanelList; if (chanelList != null && chanelList.Length > 0) { for (int iChanel = 0; iChanel < chanelList.Length; iChanel++) { EditorChanel chanel = chanelList[iChanel]; TeleportChanelVO chanelVO = ConfigVO<TeleportChanelVO>.Instance.GetData(chanel.chanelId); if (chanelVO != null) { EditorLocation[] locations = GamingMap.GetEditorLocations(chanelVO.EndGamingMap, chanelVO.EndGamingMapArea); if (locations != null && locations.Length > 0) { List<EditorLocation> locationList = new List<EditorLocation>(); for (int iLocation = 0; iLocation < locations.Length; iLocation++) { EditorLocation location = locations[iLocation]; if (location.locationType == (int)LocationType.TeleportIn) { locationList.Add(location); } } for (int iLocation = 0; iLocation < locationList.Count; iLocation++) { if (locationList[iLocation].locationId == chanel.eLocation) { m_SelectLocation.Add(new TeleportInfo(chanel.chanelId, iLocation)); break; } } } } } } } } }
public IEnumerator OnUpdate(GamingMapArea mapArea) { m_GamingMapArea = mapArea; if (m_CreateCreatureEnumerator != null) { while (m_CreateCreatureEnumerator.MoveNext()) { yield return(null); } m_CreateCreatureEnumerator = null; m_EditorCreature = null; } yield return(null); m_BindTeleports = gameObject.GetComponentsInChildren <BindTeleport>(); if (m_BindTeleports != null && m_BindTeleports.Length > 0) { for (int iBind = 0; iBind < m_BindTeleports.Length; iBind++) { if (m_BindTeleports[iBind] == null || m_BindTeleports[iBind].gameObject == null) { continue; } IEnumerator bindTeleportEnumerator = m_BindTeleports[iBind].DoUpdate(m_GamingMapArea); if (bindTeleportEnumerator != null) { while (bindTeleportEnumerator.MoveNext()) { yield return(null); } } } } yield return(null); m_CreatureCache = gameObject.GetComponentsInChildren <Creature>(); CalcuateMaxCreatureId(); if (m_CreatureCache != null && m_CreatureCache.Length > 0) { for (int iCreatureCache = 0; m_CreatureCache != null && iCreatureCache < m_CreatureCache.Length; iCreatureCache++) { IEnumerator creatureEnumrator = m_CreatureCache[iCreatureCache].OnUpdate(this, m_ShowModel); if (creatureEnumrator != null) { while (m_CreatureCache != null && m_CreatureCache[iCreatureCache] != null && creatureEnumrator != null && creatureEnumrator.MoveNext()) { yield return(null); } } } } yield return(null); }
private void OnEnable() { m_Target = target as GamingMapArea; m_Target.LoadRelieveCreature(); if (m_Target.m_RelieveIdCache != null) { m_SelectRelieveIndex = m_Target.m_RelieveIdCache.IndexOf(m_Target.m_RelieveCreatue); } m_LastSelectRelieveIndex = m_SelectRelieveIndex; m_NeedDeleteMissions = new List <int>(); RefreshMissionIds(); }
/// <summary> /// 显示模型 /// </summary> public void ShowModel() { if (string.IsNullOrEmpty(m_ModelPath)) { if (transform.childCount > 0) { for (int iChild = transform.childCount - 1; iChild >= 0; iChild--) { DestroyImmediate(transform.GetChild(iChild).gameObject); } } } if (transform.childCount > 0) { for (int iChild = 0; iChild < transform.childCount; iChild++) { transform.GetChild(iChild).gameObject.SetActive(true); } return; } string modelPath = GetModelPath(); GamingMap map = m_Root.GetGamingMap(); if (!string.IsNullOrEmpty(modelPath)) { GameObject teleportTemplete = AssetDatabase.LoadAssetAtPath <GameObject>(modelPath); if (teleportTemplete != null) { GameObject locationObj = GameObject.Instantiate(teleportTemplete); Collider[] colliders = locationObj.GetComponents <Collider>(); if ((colliders == null || colliders.Length <= 0) && m_Root.GetGamingMapType() != GamingMapType.mapMainCity) { CapsuleCollider collider = EditorGamingMapData.CalculateCapsuleCollider(locationObj); if (collider != null) { GamingMapArea area = m_Root.m_GamingMapArea; if (area != null) { area.SetMaxWarShipHeight(collider.height); } } } locationObj.transform.SetParent(transform); locationObj.transform.localPosition = Vector3.zero; locationObj.transform.localRotation = Quaternion.identity; locationObj.transform.localScale = Vector3.one; } } }
/// <summary> /// 保存GamingMapArea /// </summary> /// <param name="area"></param> public void SaveGamingArea(GamingMapArea area) { if (area == null || area.gameObject == null) { return; } string areaName = area.GetAreaScenePath(); if (string.IsNullOrEmpty(areaName)) { if (!Application.isBatchMode) { EditorUtility.DisplayDialog("提示", "不存在Area场景", "确定"); } return; } string areaPath = areaName.Replace("Assets", Application.dataPath); Scene areaScene; if (!File.Exists(areaPath)) { areaScene = EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Additive); } else { areaScene = EditorSceneManager.OpenScene(areaName, OpenSceneMode.Additive); } if (areaScene != null) { GameObject[] rootObjs = areaScene.GetRootGameObjects(); if (rootObjs != null && rootObjs.Length > 0) { for (int rIndex = 0; rIndex < rootObjs.Length; rIndex++) { GameObject.DestroyImmediate(rootObjs[rIndex]); } } area.transform.SetParent(null); EditorSceneManager.MoveGameObjectToScene(area.gameObject, areaScene); SceneManager.SetActiveScene(areaScene); } EditorSceneManager.SaveScene(areaScene, areaName); EditorSceneManager.CloseScene(areaScene, true); if (area != null && area.gameObject != null) { GameObject.DestroyImmediate(area.gameObject); } }
/// <summary> /// 结束导出 /// </summary> public void EndExport() { if (m_GamingAreaList != null && m_GamingAreaList.Count > 0) { for (int iGaming = 0; iGaming < m_GamingAreaList.Count; iGaming++) { GamingMapArea mapArea = m_GamingAreaList[iGaming]; if (mapArea != null && mapArea.gameObject != null) { mapArea.Clear(); } } } m_GamingAreaList = null; }
private void SyncArea(GamingMapArea area) { AreaSpawner[] areaSpawners = FindObjectsOfType <AreaSpawner>(); if (areaSpawners != null && areaSpawners.Length > 0) { for (int iArea = 0; iArea < areaSpawners.Length; iArea++) { if (areaSpawners[iArea].m_AreaUid == area.m_AreaId) { area.AdjustTransform(areaSpawners[iArea]); break; } } } }
public IEnumerator OnUpdate(GamingMapArea mapArea) { m_GamingMapArea = mapArea; GetTeleportList(); yield return null; if (m_CreateTeleportEnumerator != null) { while (m_CreateTeleportEnumerator.MoveNext()) { yield return null; } m_CreateTeleportEnumerator = null; m_EditorTeleport = null; } yield return null; }
public IEnumerator OnUpdate(GamingMapArea mapArea) { MapLeap[] mapLeaps = FindObjectsOfType <MapLeap>(); if (mapLeaps != null && mapLeaps.Length > 0) { for (int iMap = 0; iMap < mapLeaps.Length; iMap++) { if (mapLeaps[iMap].m_AreaId == mapArea.m_AreaId) { transform.position = mapLeaps[iMap].GetPosition(); break; } } } yield return(null); m_Collider = GetComponent <SphereCollider>(); if (m_Collider == null) { m_Collider = gameObject.AddComponent <SphereCollider>(); } m_Collider.radius = 0.5f + m_Offest + mapArea.GetMaxWarShipHeight() / 2; m_GamingMapArea = mapArea; m_LeapId = mapArea.m_AreaId; GamingMap gamingMap = m_GamingMapArea.m_GamingMap; m_LeapOverView = gamingMap.m_LeapOverview; yield return(null); RefreshColliderState(); yield return(null); transform.localScale = Vector3.one * m_Range; //可见跃迁点每帧去算 是因为以防所有GamingMapArea加载进来后,策划手动去改了其他区域的跃迁点信息 List <ulong> cacheList = gamingMap.m_LeapIdCache; cacheList.Clear(); CalcuateVisibleList(ref cacheList); m_VisibleLeapList = cacheList.ToArray(); yield return(null); }
public IEnumerator OnUpdate(LeapOverview leapOverview, GamingMapArea area, GamingMapArea showArea) { m_LeapOverview = leapOverview; m_MeshRender = GetComponent <MeshRenderer>(); gameObject.SetActive(m_IsExportToJson); if (m_MeshRender != null) { if (showArea == null) { m_MeshRender.enabled = false; } else { LeapRoot root = showArea.m_LeapRoot; bool show = false; if (root != null && root.m_VisibleLeapList.Length > 0) { for (int iVisible = 0; iVisible < root.m_VisibleLeapList.Length; iVisible++) { if (m_LeapId == root.m_VisibleLeapList[iVisible]) { show = true; break; } } } m_MeshRender.enabled = show; } } yield return(null); if (area != null && area.m_LeapRoot != null) { LeapRoot leapRoot = area.m_LeapRoot; m_LeapName = leapRoot.m_LeapName; m_LeapType = leapRoot.m_LeapType; m_MainLeapId = leapRoot.m_MainLeapId; transform.position = leapRoot.transform.position; gameObject.name = string.Format("{0}_{1}", m_LeapId, m_LeapName); transform.localScale = Vector3.one * leapRoot.m_Range; } }
private void OnEnable() { m_Target = target as TreasureRoot; GamingMapArea gamingArea = m_Target.m_GamingMapArea; if (gamingArea != null) { Area[] areas = FindObjectsOfType <Area>(); if (areas != null && areas.Length > 0) { for (int iArea = 0; iArea < areas.Length; iArea++) { Area area = areas[iArea]; if (area.Uid == gamingArea.m_AreaId) { marks = area.GetSemaphoreMarks(); } } } } }
/// <summary> /// 刷新GamingMapArea ui /// </summary> /// <param name="area"></param> private void RefreshMapAreaUI(GamingMapArea area) { if (area == null) { return; } m_ContentCache.Clear(); m_ContentCache.Add(new GUIContent("重置")); m_ContentCache.Add(new GUIContent("保存至Scene")); m_ContentCache.Add(new GUIContent("读取json数据")); m_ContentCache.Add(new GUIContent("同步Area")); Vector2 mousePosition = Event.current.mousePosition; GameObject userData = Selection.activeGameObject; int selected = -1; EditorUtility.DisplayCustomMenu(new Rect(mousePosition.x, mousePosition.y, 0, 0), m_ContentCache.ToArray(), selected, delegate(object data, string[] opt, int select) { switch (select) { case 0: //重置 ResetArea(area); break; case 1: //保存至Scene SaveGamingArea(area); break; case 2: //读取json数据 ReadJsonData(area); break; case 3: SyncArea(area); break; } }, userData); Event.current.Use(); }
public IEnumerator OnUpdate(GamingMapArea mapArea) { m_GamingMapArea = mapArea; GamingMapType mapType = m_GamingMapArea.GetGamingMapType(); if (mapType != m_lastGamingMapType) { ResetModelPath(); } m_lastGamingMapType = mapType; if (m_CreateTeleportEnumerator != null) { while (m_CreateTeleportEnumerator.MoveNext()) { yield return(null); } m_CreateTeleportEnumerator = null; m_EditorLocation = null; } yield return(null); m_LocationCache = gameObject.GetComponentsInChildren <Location>(); CalcuateMaxLocationId(); if (m_LocationCache != null && m_LocationCache.Length > 0) { for (int iLocation = 0; m_LocationCache != null && iLocation < m_LocationCache.Length; iLocation++) { IEnumerator locationEnumerator = m_LocationCache[iLocation].OnUpdate(this, m_ShowModel); if (locationEnumerator != null) { while (m_LocationCache != null && m_LocationCache[iLocation] != null && locationEnumerator.MoveNext()) { yield return(null); } } } } yield return(null); }
/// <summary> /// 创建GameArea /// </summary> /// <param name="areaSpawner"></param> private void CreateGamingArea(AreaSpawner areaSpawner) { string areaTemplete = ""; GamingMapEditorSetting gamingSetting = GamingMapEditorUtility.GetGamingMapEditorSetting(); if (gamingSetting != null) { areaTemplete = gamingSetting.m_GamingAreaTemplete; } GameObject areaTempleteAsset = AssetDatabase.LoadAssetAtPath <GameObject>(areaTemplete); GameObject obj = Instantiate(areaTempleteAsset); obj.name = string.Format("Area_{0}", areaSpawner.GetAreaId()); obj.transform.SetParent(transform); GamingMapArea area = obj.GetComponent <GamingMapArea>(); if (area == null) { area = obj.AddComponent <GamingMapArea>(); } area.Init(areaSpawner, this); m_GamingAreaList.Add(area); }
public IEnumerator OnUpdate(GamingMap gamingMap) { m_GamingMap = gamingMap; if (m_LeapList == null) { m_LeapList = new List <Leap>(); } m_LeapList.Clear(); Leap[] leaps = GetComponentsInChildren <Leap>(true); if (leaps != null && leaps.Length > 0) { for (int iLeap = 0; iLeap < leaps.Length; iLeap++) { m_LeapList.Add(leaps[iLeap]); } } yield return(null); //为了确定有没有遗漏没有的跃迁点 if (m_GamingMap != null) { List <GamingMapArea> areaList = m_GamingMap.m_GamingAreaList; if (areaList != null && areaList.Count > 0) { for (int iArea = 0; iArea < areaList.Count; iArea++) { GamingMapArea area = areaList[iArea]; if (area != null) { LeapRoot leapRoot = area.m_LeapRoot; if (leapRoot != null) { Leap leap = GetLeap(leapRoot.m_LeapId); if (leap == null) { leap = CreateLeap(leapRoot); m_LeapList.Add(leap); } } } } } } yield return(null); //因为只能由一个区域在线 GamingMapArea showArea = null; if (m_GamingMap.m_GamingAreaList != null && m_GamingMap.m_GamingAreaList.Count > 0) { showArea = m_GamingMap.m_GamingAreaList[0]; } //刷新Leap if (m_LeapList != null && m_LeapList.Count > 0) { for (int iLeap = 0; iLeap < m_LeapList.Count; iLeap++) { Leap leap = m_LeapList[iLeap]; IEnumerator leapUpdateEnum = leap.OnUpdate(this, GetArea(leap.m_LeapId), showArea); while (leapUpdateEnum != null && leapUpdateEnum.MoveNext()) { yield return(null); } } } yield return(null); }
/// <summary> /// 右键响应 /// </summary> /// <param name="instanceID"></param> /// <param name="selectionRect"></param> private void OnHierarchyGUI(int instanceID, Rect selectionRect) { if (Event.current != null && selectionRect.Contains(Event.current.mousePosition) && Event.current.button == 1 && Event.current.type <= EventType.MouseUp) { GameObject selectedGameObject = EditorUtility.InstanceIDToObject(instanceID) as GameObject; if (selectedGameObject) { CreatureRoot creatureRoot = selectedGameObject.GetComponent <CreatureRoot>(); if (creatureRoot != null) { RefreshCreatureRootUI(creatureRoot); } Creature creature = selectedGameObject.GetComponent <Creature>(); if (creature != null) { RefreshCreatureUI(creature); } LocationRoot locationRoot = selectedGameObject.GetComponent <LocationRoot>(); if (locationRoot != null) { RefreashLocationRootUI(locationRoot); } Location location = selectedGameObject.GetComponent <Location>(); if (location != null) { RefreshLocationUI(location); } TriggerRoot triggerRoot = selectedGameObject.GetComponent <TriggerRoot>(); if (triggerRoot != null) { RefreshTriggerRootUI(triggerRoot); } Trigger trigger = selectedGameObject.GetComponent <Trigger>(); if (trigger != null) { RefreshTriggerUI(trigger); } TeleportRoot teleportRoot = selectedGameObject.GetComponent <TeleportRoot>(); if (teleportRoot != null) { RefreashTeleportRootUI(teleportRoot); } GamingMapArea mapArea = selectedGameObject.GetComponent <GamingMapArea>(); if (mapArea != null) { RefreshMapAreaUI(mapArea); } GamingMap map = selectedGameObject.GetComponent <GamingMap>(); if (map != null) { RefreshMapUI(map); } Leap leap = selectedGameObject.GetComponent <Leap>(); if (leap != null) { RefreshLeapUI(leap); } } } }
public void LoadGamingMapArea(AreaSpawner areaSpawner, bool closeOtherArea = true) { if (areaSpawner == null) { return; } string m_AreaScenePath = string.Format("{0}/GamingMapArea_{1}_{2}.unity", GetOwnerAreaPath(), m_Uid, areaSpawner.GetAreaId()); if (string.IsNullOrEmpty(m_AreaScenePath)) { Debug.LogError("m_AreaScenePath == null"); return; } GamingMapArea[] areaArray = UnityEngine.Object.FindObjectsOfType <GamingMapArea>(); if (areaArray != null && areaArray.Length > 0) { for (int iArea = 0; iArea < areaArray.Length; iArea++) { GamingMapArea area = areaArray[iArea]; if (area != null && area.m_AreaId == areaSpawner.GetAreaId()) { //Debug.LogError(string.Format("{0}Area已导入", area.m_AreaId)); return; } } } if (closeOtherArea) { SaveOtherGamingArea(); } string areaScenePath = m_AreaScenePath.Replace("Assets", Application.dataPath); Scene areaScene; if (!File.Exists(areaScenePath)) { string gamingAreaPath = ""; GamingMapEditorSetting gamingSetting = GamingMapEditorUtility.GetGamingMapEditorSetting(); if (gamingSetting != null) { gamingAreaPath = gamingSetting.m_GamingAreaTemplete; } areaScene = EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Additive); GameObject areaTempleteAsset = AssetDatabase.LoadAssetAtPath <GameObject>(gamingAreaPath); GameObject gamingArea = GameObject.Instantiate(areaTempleteAsset); GamingMapArea mapArea = gamingArea.GetComponent <GamingMapArea>(); mapArea.Init(areaSpawner, this); EditorSceneManager.MoveGameObjectToScene(gamingArea, areaScene); EditorSceneManager.SaveScene(areaScene, m_AreaScenePath); EditorSceneManager.CloseScene(areaScene, true); AssetDatabase.Refresh(); } areaScene = EditorSceneManager.OpenScene(m_AreaScenePath, OpenSceneMode.Additive); if (areaScene != null) { GamingMapArea mapArea = null; GameObject[] rootObjs = areaScene.GetRootGameObjects(); if (rootObjs != null && rootObjs.Length > 0) { for (int rIndex = 0; rIndex < rootObjs.Length; rIndex++) { mapArea = rootObjs[rIndex].GetComponent <GamingMapArea>(); if (mapArea != null) { break; } } } if (mapArea != null) { EditorSceneManager.MoveGameObjectToScene(mapArea.gameObject, GetOwnerScene()); mapArea.transform.SetParent(transform); } EditorSceneManager.CloseScene(areaScene, true); } }