示例#1
0
        public override bool StartTransport(NPCInstance npc)
        {
            if (null == npc.HostMap)
            {
                return(false);
            }

            if (mPathNodes.targetPosNode.Count == 0)
            {
                var tplMapWay = CommonUtil.GetMapWayDataByType(npc.Camp, eCarType.FoodCar);
                if (null == tplMapWay)
                {
                    return(false);
                }

                mPathNodes.CleanUp();
                mPathNodes.targetPosNode.AddLast(tplMapWay.path1);
                mPathNodes.targetPosNode.AddLast(tplMapWay.path2);
                mPathNodes.targetPosNode.AddLast(tplMapWay.path3);
                mPathNodes.targetPosNode.AddLast(tplMapWay.path4);
                mPathNodes.targetPosNode.AddLast(tplMapWay.path5);
                mPathNodes.currNode = mPathNodes.targetPosNode.First;
            }

            int targetPath = 0;

            if (!mPathNodes.GetCurTargetPos(ref targetPath))
            {
                return(false);
            }

            List <UInt64>        wayPoints = npc.HostMap.GetWayPointList(targetPath);
            LinkedList <Vector3> nodes     = new LinkedList <Vector3>();

            foreach (var id in wayPoints)
            {
                WayPoint wp = npc.HostMap.GetWayPoint(id);
                if (null == wp)
                {
                    continue;
                }
                nodes.AddLast(wp.GetPosition());
            }
            npc.SetMoveNodes(nodes);

            npc.ChangeState(eNPCState.Transport);

            return(true);
        }