コード例 #1
0
        public override bool SelectTarget(NPCInstance npc)
        {
            if (!base.SelectTarget(npc))
            {
                return(false);
            }

            RoleActor target = npc.GetTarget(npc.mAttackTarget);

            return(npc.FollowTarget(target));
        }
コード例 #2
0
        public override bool OnFollowTarget(NPCInstance npc)
        {
            if (npc.CanCastSpell())
            {
                //到释放技能距离
                npc.ChangeState(eNPCState.WaitCoolDown);
            }
            else
            {
                if (npc.IsMoving)
                {
                    return(false);
                }

                if (!npc.FollowTarget(npc.GetTarget(npc.mAttackTarget)))
                {
                    npc.ReturnSpawnPoint();
                    return(false);
                }
            }

            return(true);
        }
コード例 #3
0
        public virtual bool SelectTarget(NPCInstance npc)
        {
            RoleActor target = null;

            npc.mScanLastTime = 0;
            if (npc.mAttackTarget != 0)
            {
                target = npc.GetTarget(npc.mAttackTarget);
                if (null != target)
                {
                    if (target.IsDie)
                    {
                        npc.KickOneFromEnmityList(npc.mAttackTarget);
                        npc.mAttackTarget = 0;
                        target            = null;
                    }
                }
                else
                {
                    npc.mAttackTarget = 0;
                }
            }
            //从警戒范围找目标
            if (null == target)
            {
                target = npc.FindHatredTarget();
            }
            if (null == target)
            {
                return(false);
            }

            npc.UpdateEnmityList(target.Id, 1);

            return(true);
        }