Exemplo n.º 1
0
 protected internal PathQueue(int maxSearchNodeCount, NavMesh nav)
 {
     m_navquery = new NavMeshQuery(nav);
     for (int i = 0; i < MAX_QUEUE; ++i)
     {
         m_queue[i]      = new PathQuery();
         m_queue[i].@ref = DT_PATHQ_INVALID;
         m_queue[i].path = new List <long>(50);
     }
     m_queueHead = 0;
 }
Exemplo n.º 2
0
        protected internal virtual long request(long startRef, long endRef, float[] startPos, float[] endPos, QueryFilter filter)
        {
            // Find empty slot
            int slot = -1;

            for (int i = 0; i < MAX_QUEUE; ++i)
            {
                if (m_queue[i].@ref == DT_PATHQ_INVALID)
                {
                    slot = i;
                    break;
                }
            }
            // Could not find slot.
            if (slot == -1)
            {
                return(DT_PATHQ_INVALID);
            }

            long @ref = m_nextHandle++;

            if (m_nextHandle == DT_PATHQ_INVALID)
            {
                m_nextHandle++;
            }

            PathQuery q = m_queue[slot];

            q.@ref = @ref;
            DetourCommon.vCopy(q.startPos, startPos);
            q.startRef = startRef;
            DetourCommon.vCopy(q.endPos, endPos);
            q.endRef    = endRef;
            q.status    = null;
            q.filter    = filter;
            q.keepAlive = 0;
            return(@ref);
        }