Exemple #1
0
        internal bool AddAgent(CrowdMoveAgent agent)
        {
            if (m_IsAppQuit || agent == null || m_Mgr == null)
            {
                return(false);
            }
            var          param = agent.GetParams();
            var          pt    = agent.transform.position;
            NavmeshPoint pp;
            Vector3      extends = agent.Extends;

            if (!NavMeshMap.GetNavmeshPoint(pt, extends, out pp, agent.GetFilter()))
            {
                return(false);
            }
            agent.transform.position = pp.point;
            CrowdAgent a = m_Mgr.AddAgent(pp.point, param);

            agent._SetAgent(a);
            agent._SetId(NewGlobalId());
            var node = agent.ListNode;
            var list = node.List;

            if (list != m_AgentList)
            {
                if (list != null)
                {
                    list.Remove(node);
                }
                m_AgentList.AddLast(node);
            }
            return(true);
        }
Exemple #2
0
        private bool Follow(Vector3 pos)
        {
            if (!IsInited || !NavMeshMap.IsVaild)
            {
                return(false);
            }
            NavmeshPoint pt;

            if (!NavMeshMap.GetNavmeshPoint(pos, this.Extends, out pt, GetFilter()))
            {
                return(false);
            }
            return(Follow(pt));
        }