using cfg.CampCfg; using Cysharp.Threading.Tasks; using Framework; using Gameplay.Common; using PhxhSDK; using PhxhSDK.Res; using System.Collections.Generic; using TGS; using UnityEngine; namespace Gameplay.Camp { /// /// 营地 /// public sealed partial class Camp { /// /// 营地物件根节点 /// private Transform tsCampObjectRoot; public Camp() { InitCell(); InitLoad(); InitUnit(); InitEdit(); } public async UniTask SetInfo(SceneHandle sceneHandle) { TerrainGridSystem terrainGridSystem = SceneHandle.GetSceneRootComponent(sceneHandle.Scene); if (null == terrainGridSystem) { DebugUtil.LogError($"场景中没有{nameof(TerrainGridSystem)}"); return; } GameObject[] gameObjects = sceneHandle.Scene.GetRootGameObjects(); foreach (GameObject goRoot in gameObjects) { if ("CampObjects" == goRoot.name) { tsCampObjectRoot = goRoot.transform; break; } } SetInfoByCell(terrainGridSystem); await SetInfoByLoad(); } public void Exit() { ExitEdit(); ExitUnit(); ExitLoad(); ExitCell(); tsCampObjectRoot = null; } } }