コード例 #1
0
        public override void OnTickIdle(ObjNPC npc, float delta)
        {
            if (npc.Scene == null)
            {
                return;
            }

            if (npc.IsDead())
            {
                return;
            }

            if (npc.IsAggressive())
            {
                if (npc.TableNpc.ViewDistance > 0)
                {
                    var target = ScanEnemy(npc, (float)npc.TableNpc.ViewDistance);
                    if (target != null)
                    {
                        npc.EnterState(BehaviorState.Combat);
                        npc.PushHatre(target, 1);
                        npc.AddEnemy(target.ObjId);
                        target.AddEnemy(npc.ObjId);
                    }
                }
            }
        }
コード例 #2
0
        public override void OnTickIdle(ObjNPC npc, float delta)
        {
            if (npc.Scene == null)
            {
                return;
            }

            if (npc.IsDead())
            {
                return;
            }

            if (npc.IsAggressive())
            {
                if (npc.TableNpc.ViewDistance > 0)
                {
                    var target = npc.ScanEnemy((float)npc.TableNpc.ViewDistance);
                    if (target != null)
                    {
                        npc.EnterState(BehaviorState.Combat);
                        npc.PushHatre(target, 1);
                        npc.AddEnemy(target.ObjId);
                        target.AddEnemy(npc.ObjId);

                        // 搜索仇恨组
                        if (npc.tbSceneNpc != null && npc.tbSceneNpc.ChouHenGroupId != -1)
                        {
                            TryToCallPartner(npc, target, 2000);
                        }
                    }
                }
            }
        }
コード例 #3
0
        public override void OnTickIdle(ObjNPC npc, float delta)
        {
            if (npc.IsAggressive())
            {
                if (npc.TableNpc.ViewDistance > 0)
                {
                    var target = ScanEnemy(npc, (float)npc.TableNpc.ViewDistance);
                    if (target != null)
                    {
                        npc.EnterState(BehaviorState.Combat);
                        npc.PushHatre(target, 1);
                        npc.AddEnemy(target.ObjId);
                        target.AddEnemy(npc.ObjId);
                        return;
                    }
                }
            }

            if (!npc.CanMove())
            {
                return;
            }

            if (npc.IsMoving())
            {
                return;
            }

            if (mPtIdx < 0 || mPtIdx >= ListDestination.Count)
            {
                //npc.Disapeare();
                return;
            }

            if (mTime > DateTime.Now)
            {
                return;
            }

            if (MoveResult.AlreadyThere == npc.MoveTo(ListDestination[mPtIdx]))
            {
                mPtIdx++;
                mTime = DateTime.Now.AddSeconds(WaitTime);
            }
        }
コード例 #4
0
        public override void OnTickIdle(ObjNPC npc, float delta)
        {
            if (npc.Scene == null)
            {
                return;
            }

            if (npc.IsDead())
            {
                return;
            }

            if (npc.IsAggressive())
            {
                if (npc.TableNpc.ViewDistance > 0)
                {
                    FindNpcEnemy(npc, (float)npc.TableNpc.ViewDistance);
                }
            }
        }