namespace ET { public class PeopleAIComponentAwakeSystem: AwakeSystem { public override void Awake(PeopleAIComponent self) { self.Awake(); } } [FriendClass(typeof(PeopleViewComponent))] [FriendClass(typeof(People))] public static class PeopleAIComponentSystem { public static void Awake(this PeopleAIComponent self) { self.RunAI().Coroutine(); } public static async ETTask RunAI(this PeopleAIComponent self) { while (true) { // 检测时间 await TimerComponent.Instance.WaitAsync(1000); var peopleViewComp = self.Parent.GetComponent(); if (peopleViewComp.People.GetBehaveType() == ConstBehaveType.BEHAVE_IDLE) { var radius = RandomHelper.RandomNumber(5, 10); peopleViewComp.MoveToPos(PeopleViewHelper.GetRandomMovePos(peopleViewComp, radius)); var moveTime = RandomHelper.RandomNumber(10000,30000); await TimerComponent.Instance.WaitAsync(moveTime); } } } } }