Exemple #1
0
 public override bool OnIdle(NPCInstance npc)
 {
     if (npc.mStateLastTime > GameSet.Instance.ChallengeWaitTime)
     {
         if (npc.SelectSpell())
         {
             npc.ChangeState(eNPCState.FollowTarget);
         }
     }
     return(true);
 }
Exemple #2
0
        public override bool FollowTarget(NPCInstance npc, RoleActor target)
        {
            if (!base.FollowTarget(npc, target))
            {
                return(false);
            }

            //超出追击范围
            if (Util.DistanceH(npc.GetPosition(), npc.mSpawnPoint) > npc.InMapData.followRange)
            {
                return(false);
            }

            npc.SelectSpell();

            if (npc.CanCastSpell())
            {
                //到释放技能距离
                npc.ChangeState(eNPCState.WaitCoolDown);
            }
            else
            {
                if (npc.InMapData.followRange > 0)
                {
                    Vector3 standPos = target.GetSurroundPosition(npc.GetPosition(), (int)npc.mCastSpellDistance, npc.Id);
                    if (!Util.PassableForMod(npc.HostMap.Navigator, standPos))
                    {
                        if (!Util.PassableForMod(npc.HostMap.Navigator, target.GetPosition()))
                        {
                            return(false);
                        }

                        standPos = target.GetPosition();
                    }

                    if (!npc.MoveTo(standPos))
                    {
                        return(false);
                    }
                }

                npc.ChangeState(eNPCState.FollowTarget);
            }

            return(true);
        }