Example #1
0
        public override bool OnTransport(NPCInstance npc)
        {
            if (null == npc)
            {
                return(false);
            }

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

            TriggerInstance trigger = npc.HostMap.InTriggerRange(npc);

            if (null == trigger)
            {
                npc.ChangeState(eNPCState.Pause);
                mPathNodes.CleanUp();
                npc.OnLeaveMap();
            }
            else
            {
                if (!mPathNodes.NextTargetPos())
                {
                    npc.ChangeState(eNPCState.Pause);
                    return(false);
                }

                npc.Trigger = trigger;
                npc.OnJumpToMap();
                npc.ChangeState(eNPCState.WaitJumpMap);
            }

            return(true);
        }