using UnityEngine; namespace ET.Client { [EntitySystemOf(typeof(OperaComponent))] [FriendOf(typeof(OperaComponent))] public static partial class OperaComponentSystem { [EntitySystem] private static void Awake(this OperaComponent self) { self.mapMask = LayerMask.GetMask("Map"); } [EntitySystem] private static void Update(this OperaComponent self) { if (Input.GetMouseButtonDown(1)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 1000, self.mapMask)) { C2M_PathfindingResult c2MPathfindingResult = C2M_PathfindingResult.Create(); c2MPathfindingResult.Position = hit.point; self.Root().GetComponent().Send(c2MPathfindingResult); } } if (Input.GetKeyDown(KeyCode.Q)) { self.Test1().Coroutine(); } if (Input.GetKeyDown(KeyCode.W)) { self.Test2().Coroutine(); } if (Input.GetKeyDown(KeyCode.R)) { CodeLoader.Instance.Reload(); return; } if (Input.GetKeyDown(KeyCode.T)) { C2M_TransferMap c2MTransferMap = C2M_TransferMap.Create(); self.Root().GetComponent().Call(c2MTransferMap).Coroutine(); } } private static async ETTask Test1(this OperaComponent self) { Log.Debug($"Croutine 1 start1 "); using (await self.Root().GetComponent().Wait(1, 20000, 3000)) { await self.Root().GetComponent().WaitAsync(6000); } Log.Debug($"Croutine 1 end1"); } private static async ETTask Test2(this OperaComponent self) { Log.Debug($"Croutine 2 start2"); using (await self.Root().GetComponent().Wait(1, 20000, 3000)) { await self.Root().GetComponent().WaitAsync(1000); } Log.Debug($"Croutine 2 end2"); } } }