Beispiel #1
0
        public override async ETTask Execute(AIComponent aiComponent, AIConfig aiConfig, ETCancellationToken cancellationToken)
        {
            Scene zoneScene = aiComponent.DomainScene();

            Unit myUnit = UnitHelper.GetMyUnitFromZoneScene(zoneScene);

            if (myUnit == null)
            {
                return;
            }

            Log.Debug("开始巡逻");

            while (true)
            {
                XunLuoPathComponent xunLuoPathComponent = myUnit.GetComponent <XunLuoPathComponent>();
                Vector3             nextTarget          = xunLuoPathComponent.GetCurrent();
                int ret = await myUnit.MoveToAsync(nextTarget, cancellationToken);

                if (ret != 0)
                {
                    return;
                }
                xunLuoPathComponent.MoveNext();
            }
        }
Beispiel #2
0
        public override async ETTask Execute(AIComponent aiComponent, AIConfig aiConfig, ETCancellationToken cancellationToken)
        {
            Scene zoneScene = aiComponent.DomainScene();

            Unit myUnit = UnitHelper.GetMyUnitFromZoneScene(zoneScene);

            if (myUnit == null)
            {
                return;
            }

            // 停在当前位置
            zoneScene.GetComponent <SessionComponent>().Session.Send(new C2M_Stop());

            Log.Debug("开始攻击");

            for (int i = 0; i < 100000; ++i)
            {
                Log.Debug($"攻击: {i}次");

                // 因为协程可能被中断,任何协程都要传入cancellationToken,判断如果是中断则要返回
                bool timeRet = await TimerComponent.Instance.WaitAsync(1000, cancellationToken);

                if (!timeRet)
                {
                    return;
                }
            }
        }
Beispiel #3
0
        protected override void Run(EventType.AfterCombatUnitComponentCreate args)
        {
            var self = args.CombatUnitComponent;

            if (UnitHelper.GetMyUnitFromZoneScene(self.ZoneScene()) == self.unit)
            {
                self.AddComponent <SpellPreviewComponent>();
            }
        }
Beispiel #4
0
        public override void Awake(TargetSelectComponent self)
        {
            //CursorImage = GetComponent<Image>();
            self.CursorColor = Color.white;
            self.waiter      = ETTask <GameObject> .Create();

            self.Init().Coroutine();

            self.HeroObj = UnitHelper.GetMyUnitFromZoneScene(self.ZoneScene()).GetComponent <GameObjectComponent>().GameObject;
        }
Beispiel #5
0
        public override void Awake(DirectRectSelectComponent self)
        {
            self.waiter = ETTask <GameObject> .Create();

            string path = "GameAssets/SkillPreview/Prefabs/DirectRectSelectManager.prefab";

            GameObjectPoolComponent.Instance.GetGameObjectAsync(path, (obj) =>
            {
                self.gameObject = obj;
                self.DirectObj  = obj.transform.GetChild(0).gameObject;
                self.AreaObj    = self.DirectObj.transform.GetChild(0).gameObject;
                self.waiter.SetResult(obj);
                self.waiter = null;
            }).Coroutine();
            self.HeroObj = UnitHelper.GetMyUnitFromZoneScene(self.ZoneScene()).GetComponent <GameObjectComponent>().GameObject;
        }
        public override void Awake(PointSelectComponent self)
        {
            self.waiter = ETTask <GameObject> .Create();

            string path = "GameAssets/SkillPreview/Prefabs/PointSelectManager.prefab";

            GameObjectPoolComponent.Instance.GetGameObjectAsync(path, (obj) =>
            {
                self.gameObject     = obj;
                self.RangeCircleObj = obj.transform.Find("RangeCircle").gameObject;
                self.SkillPointObj  = obj.transform.Find("SkillPointPreview").gameObject;
                self.waiter.SetResult(obj);
                self.waiter = null;
            }).Coroutine();
            self.HeroObj = UnitHelper.GetMyUnitFromZoneScene(self.ZoneScene()).GetComponent <GameObjectComponent>().GameObject;
        }