SafetyAreaManager.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. using SC.XR.Unity;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using System.IO;
  6. using UnityEngine;
  7. public class SafetyAreaManager : SingletonMono<SafetyAreaManager>
  8. {
  9. //是否已从配置文件中读取安全区域
  10. private static bool hasReadFromFile = false;
  11. public Action OnBeginSetSafeArea;
  12. public Action OnFinishSetSafeArea;
  13. public Action OnEnterSafetyArea;
  14. public Action OnExitSafetyArea;
  15. public Action<bool> OnDisableSafetyArea;
  16. public Action<bool> OnDoubleTapShowSafetyArea;
  17. private Dictionary<SafetyAreaStepEnum, ISafetyAreaStep> areaStepDic;
  18. private GameObject safetyAreaGameObject;
  19. private SafetyAreaMono safetyAreaMono;
  20. private ISafetyAreaStep currentStep;
  21. [HideInInspector]
  22. public StationaryAreaMono stationaryAreaMono;
  23. private GameObject stationaryAreaObject;
  24. [HideInInspector]
  25. public PlayAreaMono playAreaMono;
  26. private GameObject playAreaObject;
  27. [HideInInspector]
  28. public bool isDisableSafetyArea = false;
  29. [HideInInspector]
  30. public bool isSettingSafetyArea = false;
  31. [HideInInspector]
  32. public bool onlySettingGroundHeight = false;
  33. [HideInInspector]
  34. public bool doubleTapShowSeeThrough = true;
  35. private bool showAreaWhenBowHead = true;
  36. private float originAlphaParam = 0.4f;
  37. private int originSafetyAreaColorIndex = 0;
  38. private SafetyAreaInfo currentSafetyAreaInfo = null;
  39. private bool alreayExitSafetyArea = false;
  40. public bool DoubleClickShowSeeThrough
  41. {
  42. get
  43. {
  44. return doubleTapShowSeeThrough;
  45. }
  46. set
  47. {
  48. doubleTapShowSeeThrough = value;
  49. OnDoubleTapShowSafetyArea?.Invoke(doubleTapShowSeeThrough);
  50. }
  51. }
  52. public bool IsDisableSafetyArea
  53. {
  54. get
  55. {
  56. return isDisableSafetyArea;
  57. }
  58. set
  59. {
  60. isDisableSafetyArea = value;
  61. OnDisableSafetyArea?.Invoke(isDisableSafetyArea);
  62. }
  63. }
  64. public bool ShowAreaWhenBowHead
  65. {
  66. get
  67. {
  68. if (!hasReadFromFile)
  69. {
  70. LoadSafetyArea();
  71. }
  72. return showAreaWhenBowHead;
  73. }
  74. set
  75. {
  76. showAreaWhenBowHead = value;
  77. SaveSafetyArea();
  78. }
  79. }
  80. public int OriginSafetyAreaColorIndex
  81. {
  82. get
  83. {
  84. if (!hasReadFromFile)
  85. {
  86. LoadSafetyArea();
  87. }
  88. return originSafetyAreaColorIndex;
  89. }
  90. set
  91. {
  92. originSafetyAreaColorIndex = value;
  93. SaveSafetyArea();
  94. }
  95. }
  96. public float OriginAlphaParam
  97. {
  98. get
  99. {
  100. if (!hasReadFromFile)
  101. {
  102. LoadSafetyArea();
  103. }
  104. return originAlphaParam;
  105. }
  106. set
  107. {
  108. originAlphaParam = value;
  109. SaveSafetyArea();
  110. }
  111. }
  112. //public Color SafetyAreaColor
  113. //{
  114. // get
  115. // {
  116. // return safetyAreaColor[originSafetyAreaColorIndex];
  117. // }
  118. //}
  119. public float AlphaParam
  120. {
  121. get
  122. {
  123. return Mathf.Lerp(0f, 1f, originAlphaParam);
  124. }
  125. }
  126. //private GameObject savedSafetyArea;
  127. private void Awake()
  128. {
  129. DontDestroyOnLoad(this.gameObject);
  130. }
  131. private IEnumerator Start()
  132. {
  133. SafetyAreaLanguageManager.Instance.Init();
  134. //yield return new WaitUntil(() => GSXRManager.Instance.Initialized);
  135. yield return null;
  136. if (!hasReadFromFile)
  137. {
  138. LoadSafetyArea();
  139. }
  140. API_GSXR_Slam.GSXR_Add_SlamPauseCallback(OnLoading);
  141. }
  142. private void OnDestroy()
  143. {
  144. API_GSXR_Slam.GSXR_Remove_SlamPauseCallback(OnLoading);
  145. }
  146. private void Init(object data)
  147. {
  148. InitSafetyAreaMono();
  149. InitStep(safetyAreaMono);
  150. safetyAreaMono.Init(data);
  151. }
  152. private void Release()
  153. {
  154. OnFinishSetSafeArea?.Invoke();
  155. if (safetyAreaMono != null)
  156. {
  157. safetyAreaMono.Release();
  158. GameObject.Destroy(safetyAreaGameObject);
  159. safetyAreaMono = null;
  160. areaStepDic = null;
  161. }
  162. }
  163. private void InitStep(SafetyAreaMono safetyAreaMono)
  164. {
  165. if (areaStepDic == null)
  166. {
  167. areaStepDic = new Dictionary<SafetyAreaStepEnum, ISafetyAreaStep>();
  168. areaStepDic.Add(SafetyAreaStepEnum.GroundHeight, new GroundHeightStep(safetyAreaMono));
  169. areaStepDic.Add(SafetyAreaStepEnum.PlayArea, new PlayAreaStep(safetyAreaMono));
  170. areaStepDic.Add(SafetyAreaStepEnum.StationaryArea, new StationaryAreaStep(safetyAreaMono));
  171. //areaStepDic.Add(SafetyAreaStepEnum.ConfirmPlayArea, new ConfirmPlayAreaStep());
  172. }
  173. }
  174. private void InitSafetyAreaMono()
  175. {
  176. if (safetyAreaMono == null)
  177. {
  178. GameObject safetyAreaMonoResource = Resources.Load<GameObject>("SafetyAreaMono");
  179. safetyAreaGameObject = GameObject.Instantiate(safetyAreaMonoResource);
  180. safetyAreaMono = safetyAreaGameObject.GetComponent<SafetyAreaMono>();
  181. }
  182. //safetyAreaMono.Init();
  183. }
  184. //创建原地区域
  185. public void CreateStationarySafetyArea()
  186. {
  187. if (stationaryAreaMono == null)
  188. {
  189. stationaryAreaObject = new GameObject(PlayAreaConstant.STATIONARY_NAME);
  190. stationaryAreaObject.layer = 9;//1 << LayerMask.NameToLayer("SafetyArea");
  191. float groundHeight = 0f;//GetStep<GroundHeightStep>(SafetyAreaStepEnum.GroundHeight).GetPlaneHeight();
  192. Mesh cylinderMesh = SafetyAreaVertexHelper.GenerateCylinderMesh(new Vector3(0, groundHeight, 0), groundHeight + PlayAreaConstant.SAFETY_AREA_HEIGHT, groundHeight, PlayAreaConstant.STATIONARY_AREA_RADIUS);
  193. stationaryAreaMono = stationaryAreaObject.AddComponent<StationaryAreaMono>();
  194. stationaryAreaMono.Init();
  195. stationaryAreaMono.SetMesh(cylinderMesh, PlayAreaConstant.STATIONARY_AREA_RADIUS);
  196. }
  197. }
  198. //销毁原地区域
  199. public void DestroyStationaryArea()
  200. {
  201. if (stationaryAreaObject != null)
  202. {
  203. GameObject.Destroy(stationaryAreaObject);
  204. }
  205. stationaryAreaObject = null;
  206. stationaryAreaMono = null;
  207. }
  208. //创建安全网格
  209. public void CreatePlayArea(Mesh mesh, Color[] colors, float perimeter, Vector3 worldPosition)
  210. {
  211. if (playAreaObject != null)
  212. {
  213. GameObject.Destroy(playAreaObject);
  214. }
  215. playAreaObject = new GameObject(PlayAreaConstant.PLAY_AREA_NAME);
  216. playAreaObject.layer = LayerMask.NameToLayer("SafetyArea");
  217. playAreaObject.transform.position = new Vector3(worldPosition.x, 0f, worldPosition.z);
  218. playAreaMono = playAreaObject.AddComponent<PlayAreaMono>();
  219. playAreaMono.Init();
  220. playAreaMono.SetMesh(mesh, colors, perimeter);
  221. }
  222. public void DestroyPlayArea()
  223. {
  224. if (playAreaObject != null)
  225. {
  226. Debug.LogError("Destroy playAreaObject");
  227. GameObject.Destroy(playAreaObject);
  228. }
  229. playAreaObject = null;
  230. playAreaMono = null;
  231. }
  232. public void StartSetSafetyArea(object data = null)
  233. {
  234. if (safetyAreaMono != null)
  235. {
  236. Debug.LogError("last set safety area process not complete");
  237. return;
  238. }
  239. //if (savedSafetyArea != null)
  240. //{
  241. // savedSafetyArea.SetActive(false);
  242. //}
  243. Init(data);
  244. isSettingSafetyArea = true;
  245. OnBeginSetSafeArea?.Invoke();
  246. DestroyExistSafetyArea();
  247. SafetyAreaCommandBuffer.Instance.AddLoading();
  248. API_GSXR_Slam.GSXR_ResaveMap("forTest");
  249. API_GSXR_Slam.GSXR_StartSeeThrough();
  250. API_GSXR_Slam.GSXR_Add_SlamPauseCallback(OnSlamPause);
  251. }
  252. public void StartSetSafetyAreaHeight()
  253. {
  254. if (!CheckSafetyAreaExist())
  255. {
  256. StartSetSafetyArea();
  257. return;
  258. }
  259. onlySettingGroundHeight = true;
  260. Init(null);
  261. OnBeginSetSafeArea?.Invoke();
  262. API_GSXR_Slam.GSXR_StartSeeThrough();
  263. API_GSXR_Slam.GSXR_Add_SlamPauseCallback(OnSlamPause);
  264. }
  265. //判断安全区域是否存在
  266. public bool CheckSafetyAreaExist()
  267. {
  268. if (!hasReadFromFile)
  269. {
  270. LoadSafetyArea();
  271. }
  272. GameObject playArea = GameObject.Find(PlayAreaConstant.PLAY_AREA_NAME);
  273. if (playArea != null)
  274. {
  275. return true;
  276. }
  277. GameObject stationaryArea = GameObject.Find(PlayAreaConstant.STATIONARY_NAME);
  278. if (stationaryArea != null)
  279. {
  280. return true;
  281. }
  282. return false;
  283. }
  284. public SafetyAreaTypeEnum GetSafetyAreaType()
  285. {
  286. if (!CheckSafetyAreaExist()) return SafetyAreaTypeEnum.None;
  287. GameObject playArea = GameObject.Find(PlayAreaConstant.PLAY_AREA_NAME);
  288. if (playArea != null)
  289. {
  290. return SafetyAreaTypeEnum.PlayArea;
  291. }
  292. GameObject stationaryArea = GameObject.Find(PlayAreaConstant.STATIONARY_NAME);
  293. if (stationaryArea != null)
  294. {
  295. return SafetyAreaTypeEnum.Stationary;
  296. }
  297. return SafetyAreaTypeEnum.None;
  298. }
  299. //重新设置安全区域高度
  300. //public void ResetSafetyAreaHeight()
  301. //{
  302. // GameObject playArea = GameObject.Find(PlayAreaConstant.PLAY_AREA_NAME);
  303. // if (playArea != null)
  304. // {
  305. // playArea.GetComponent<PlayAreaMono>().ResetPlaneHeight(GetStep<GroundHeightStep>(SafetyAreaStepEnum.GroundHeight).GetPlaneHeight());
  306. // }
  307. // GameObject stationaryArea = GameObject.Find(PlayAreaConstant.STATIONARY_NAME);
  308. // if (stationaryArea != null)
  309. // {
  310. // stationaryArea.GetComponent<StationaryAreaMono>().ResetPlaneHeight(GetStep<GroundHeightStep>(SafetyAreaStepEnum.GroundHeight).GetPlaneHeight());
  311. // }
  312. //}
  313. public void DestroyExistSafetyArea()
  314. {
  315. GameObject playArea = GameObject.Find(PlayAreaConstant.PLAY_AREA_NAME);
  316. if (playArea != null)
  317. {
  318. playArea.GetComponent<PlayAreaMono>().Release();
  319. GameObject.Destroy(playArea);
  320. }
  321. GameObject stationaryArea = GameObject.Find(PlayAreaConstant.STATIONARY_NAME);
  322. if (stationaryArea != null)
  323. {
  324. stationaryArea.GetComponent<StationaryAreaMono>().Release();
  325. GameObject.Destroy(stationaryArea);
  326. }
  327. }
  328. public void ExitSafeAreaStep()
  329. {
  330. if (currentStep != null)
  331. {
  332. currentStep.OnExitStep();
  333. }
  334. currentStep = null;
  335. Release();
  336. API_GSXR_Slam.GSXR_Remove_SlamPauseCallback(OnSlamPause);
  337. API_GSXR_Slam.GSXR_StopSeeThrough();
  338. API_GSXR_Slam.GSXR_SaveMap();
  339. isSettingSafetyArea = false;
  340. onlySettingGroundHeight = false;
  341. stationaryAreaMono = null;
  342. stationaryAreaObject = null;
  343. playAreaMono = null;
  344. playAreaObject = null;
  345. SaveSafetyArea(true);
  346. }
  347. private void LoadSafetyArea()
  348. {
  349. hasReadFromFile = true;
  350. if (!File.Exists(PlayAreaConstant.SAVE_FILE_NAME))
  351. {
  352. currentSafetyAreaInfo = new SafetyAreaInfo();
  353. return;
  354. }
  355. string fileStr = File.ReadAllText(PlayAreaConstant.SAVE_FILE_NAME);
  356. currentSafetyAreaInfo = JsonUtility.FromJson<SafetyAreaInfo>(fileStr);
  357. showAreaWhenBowHead = currentSafetyAreaInfo.showAreaWhenBowHead;
  358. originAlphaParam = currentSafetyAreaInfo.originAlphaParam;
  359. originSafetyAreaColorIndex = currentSafetyAreaInfo.originSafetyAreaColorIndex;
  360. if (string.IsNullOrEmpty(currentSafetyAreaInfo.safetyAreaName))
  361. {
  362. return;
  363. }
  364. Mesh edgeMesh = new Mesh();
  365. edgeMesh.vertices = currentSafetyAreaInfo.vertices.ToArray();
  366. edgeMesh.uv = currentSafetyAreaInfo.uv.ToArray();
  367. edgeMesh.triangles = currentSafetyAreaInfo.triangles.ToArray();
  368. GameObject safetyArea = new GameObject(currentSafetyAreaInfo.safetyAreaName);
  369. safetyArea.transform.position = currentSafetyAreaInfo.position;
  370. MeshRenderer meshRenderer = safetyArea.AddComponent<MeshRenderer>();
  371. MeshFilter meshFilter = safetyArea.AddComponent<MeshFilter>();
  372. meshFilter.mesh = edgeMesh;
  373. meshRenderer.sharedMaterial = Resources.Load<Material>("Material/SafetyEdgeMat_Normal");
  374. SafetyAreaBase safetyAreaBase = null;
  375. if (currentSafetyAreaInfo.safetyAreaName == PlayAreaConstant.PLAY_AREA_NAME)
  376. {
  377. safetyAreaBase = safetyArea.AddComponent<PlayAreaMono>();
  378. safetyArea.GetComponent<PlayAreaMono>().Init();
  379. safetyArea.GetComponent<PlayAreaMono>().SetColor(currentSafetyAreaInfo.colors.ToArray());
  380. }
  381. else
  382. {
  383. safetyAreaBase = safetyArea.AddComponent<StationaryAreaMono>();
  384. safetyArea.GetComponent<StationaryAreaMono>().Init();
  385. safetyArea.GetComponent<StationaryAreaMono>().SetRadius(currentSafetyAreaInfo.radius);
  386. }
  387. //safetyAreaBase.SetOriginHeight(currentSafetyAreaInfo.originHeight);
  388. safetyAreaBase.SetPerimeter(currentSafetyAreaInfo.perimeter);
  389. }
  390. private void SaveSafetyArea(bool overrideVertexData = false)
  391. {
  392. if (overrideVertexData)
  393. {
  394. if (CheckSafetyAreaExist())
  395. {
  396. GameObject playArea = GameObject.Find(PlayAreaConstant.PLAY_AREA_NAME);
  397. if (playArea != null)
  398. {
  399. currentSafetyAreaInfo.safetyAreaName = PlayAreaConstant.PLAY_AREA_NAME;
  400. currentSafetyAreaInfo.position = playArea.transform.position;
  401. currentSafetyAreaInfo.vertices = new List<Vector3>(playArea.GetComponent<MeshFilter>().mesh.vertices);
  402. currentSafetyAreaInfo.triangles = new List<int>(playArea.GetComponent<MeshFilter>().mesh.triangles);
  403. currentSafetyAreaInfo.uv = new List<Vector2>(playArea.GetComponent<MeshFilter>().mesh.uv);
  404. //currentSafetyAreaInfo.originHeight = playArea.GetComponent<SafetyAreaBase>().GetOriginHeight();
  405. currentSafetyAreaInfo.perimeter = playArea.GetComponent<SafetyAreaBase>().GetPerimter();
  406. currentSafetyAreaInfo.colors = new List<Color>(playArea.GetComponent<PlayAreaMono>().GetColor());
  407. }
  408. GameObject stationaryArea = GameObject.Find(PlayAreaConstant.STATIONARY_NAME);
  409. if (stationaryArea != null)
  410. {
  411. currentSafetyAreaInfo.safetyAreaName = PlayAreaConstant.STATIONARY_NAME;
  412. currentSafetyAreaInfo.position = stationaryArea.transform.position;
  413. currentSafetyAreaInfo.vertices = new List<Vector3>(stationaryArea.GetComponent<MeshFilter>().mesh.vertices);
  414. currentSafetyAreaInfo.triangles = new List<int>(stationaryArea.GetComponent<MeshFilter>().mesh.triangles);
  415. currentSafetyAreaInfo.uv = new List<Vector2>(stationaryArea.GetComponent<MeshFilter>().mesh.uv);
  416. //currentSafetyAreaInfo.originHeight = stationaryArea.GetComponent<SafetyAreaBase>().GetOriginHeight();
  417. currentSafetyAreaInfo.perimeter = stationaryArea.GetComponent<SafetyAreaBase>().GetPerimter();
  418. currentSafetyAreaInfo.radius = stationaryArea.GetComponent<StationaryAreaMono>().GetRadius();
  419. }
  420. }
  421. else
  422. {
  423. currentSafetyAreaInfo.safetyAreaName = string.Empty;
  424. currentSafetyAreaInfo.position = Vector3.zero;
  425. currentSafetyAreaInfo.vertices = null;
  426. currentSafetyAreaInfo.triangles = null;
  427. currentSafetyAreaInfo.uv = null;
  428. currentSafetyAreaInfo.originHeight = 0f;
  429. }
  430. }
  431. currentSafetyAreaInfo.showAreaWhenBowHead = ShowAreaWhenBowHead;
  432. currentSafetyAreaInfo.originAlphaParam = OriginAlphaParam;
  433. currentSafetyAreaInfo.originSafetyAreaColorIndex = OriginSafetyAreaColorIndex;
  434. if (!File.Exists(PlayAreaConstant.SAVE_FILE_NAME))
  435. {
  436. if (!Directory.Exists(Path.GetDirectoryName(PlayAreaConstant.SAVE_FILE_NAME)))
  437. {
  438. Directory.CreateDirectory(Path.GetDirectoryName(PlayAreaConstant.SAVE_FILE_NAME));
  439. }
  440. File.Create(PlayAreaConstant.SAVE_FILE_NAME).Dispose();
  441. }
  442. File.WriteAllText(PlayAreaConstant.SAVE_FILE_NAME, JsonUtility.ToJson(currentSafetyAreaInfo));
  443. }
  444. public void DestroySafetyArea()
  445. {
  446. if (CheckSafetyAreaExist())
  447. {
  448. DestroyExistSafetyArea();
  449. }
  450. SaveSafetyArea();
  451. }
  452. public T GetStep<T>(SafetyAreaStepEnum safetyAreaStepEnum) where T : class, ISafetyAreaStep
  453. {
  454. if (!areaStepDic.ContainsKey(safetyAreaStepEnum))
  455. {
  456. return default(T);
  457. }
  458. return areaStepDic[safetyAreaStepEnum] as T;
  459. }
  460. public void ChangeStep(SafetyAreaStepEnum safetyAreaStep, object data = null)
  461. {
  462. if (currentStep != null)
  463. {
  464. currentStep.OnExitStep();
  465. }
  466. ISafetyAreaStep nextStep = areaStepDic[safetyAreaStep];
  467. nextStep.OnEnterStep(data);
  468. currentStep = nextStep;
  469. }
  470. public SafetyAreaStepEnum GetCurrentStepEnum()
  471. {
  472. if (currentStep == null) return SafetyAreaStepEnum.Null;
  473. return currentStep.GetStepEnum();
  474. }
  475. public void UserCancelStep()
  476. {
  477. if (currentStep != null)
  478. {
  479. currentStep.OnUserCancel();
  480. }
  481. }
  482. public void DelayExitSafeAreaStep(float delayTime, Action onExitComplete)
  483. {
  484. StartCoroutine(ExitSafeAreaStepCoroutine(delayTime, onExitComplete));
  485. }
  486. public void DelayChangeStep(SafetyAreaStepEnum safetyAreaStep, float delayTime)
  487. {
  488. StartCoroutine(ChangeStepCoroutine(safetyAreaStep, delayTime));
  489. }
  490. public void ExitSafetyAreaInvoke()
  491. {
  492. if (!alreayExitSafetyArea)
  493. {
  494. alreayExitSafetyArea = true;
  495. OnExitSafetyArea?.Invoke();
  496. }
  497. }
  498. public void EnterSafetyAreaInvoke()
  499. {
  500. if (alreayExitSafetyArea)
  501. {
  502. alreayExitSafetyArea = false;
  503. OnEnterSafetyArea?.Invoke();
  504. }
  505. }
  506. private IEnumerator ChangeStepCoroutine(SafetyAreaStepEnum safetyAreaStep, float delayTime)
  507. {
  508. yield return new WaitForSeconds(delayTime);
  509. ChangeStep(safetyAreaStep);
  510. }
  511. private IEnumerator ExitSafeAreaStepCoroutine(float delayTime, Action onExitComplete)
  512. {
  513. yield return new WaitForSeconds(delayTime);
  514. onExitComplete?.Invoke();
  515. ExitSafeAreaStep();
  516. }
  517. public void DelayShow(float delayTime, Action delayMethod)
  518. {
  519. StartCoroutine(DelayShowCoroutine(delayTime, delayMethod));
  520. }
  521. private IEnumerator DelayShowCoroutine(float delayTime, Action delayMethod)
  522. {
  523. yield return new WaitForSeconds(delayTime);
  524. delayMethod?.Invoke();
  525. }
  526. private void OnSlamPause(bool isPause)
  527. {
  528. if (!isPause)
  529. {
  530. API_GSXR_Slam.GSXR_StartSeeThrough();
  531. }
  532. }
  533. private void OnLoading(bool isPause)
  534. {
  535. if (!isPause)
  536. {
  537. SafetyAreaCommandBuffer.Instance.AddLoading();
  538. }
  539. }
  540. }