Ejemplo n.º 1
0
        public unsafe PathQueryStatus Raycast(out NavMeshHit hit, NativeSlice <PolygonId> path, out int pathCount, NavMeshLocation start, Vector3 targetPosition, int areaMask = -1, NativeArray <float> costs = default(NativeArray <float>))
        {
            AtomicSafetyHandle.CheckReadAndThrow(this.m_Safety);
            bool flag = costs.Length != 0;

            if (flag)
            {
                bool flag2 = costs.Length != 32;
                if (flag2)
                {
                    throw new ArgumentException(string.Format("The number of costs ({0}) must be exactly {1}, one for each possible area type.", costs.Length, 32), "costs");
                }
            }
            void *costs2  = (costs.Length == 32) ? costs.GetUnsafePtr <float>() : null;
            void *ptr     = (path.Length > 0) ? path.GetUnsafePtr <PolygonId>() : null;
            int   maxPath = (ptr != null) ? path.Length : 0;

            return(NavMeshQuery.Raycast(this.m_NavMeshQuery, start, targetPosition, areaMask, costs2, out hit, ptr, out pathCount, maxPath));
        }
Ejemplo n.º 2
0
        public unsafe PathQueryStatus Raycast(out NavMeshHit hit, NavMeshLocation start, Vector3 targetPosition, int areaMask = -1, NativeArray <float> costs = default(NativeArray <float>))
        {
            AtomicSafetyHandle.CheckReadAndThrow(this.m_Safety);
            bool flag = costs.Length != 0;

            if (flag)
            {
                bool flag2 = costs.Length != 32;
                if (flag2)
                {
                    throw new ArgumentException(string.Format("The number of costs ({0}) must be exactly {1}, one for each possible area type.", costs.Length, 32), "costs");
                }
            }
            void *          costs2 = (costs.Length == 32) ? costs.GetUnsafePtr <float>() : null;
            int             num;
            PathQueryStatus pathQueryStatus = NavMeshQuery.Raycast(this.m_NavMeshQuery, start, targetPosition, areaMask, costs2, out hit, null, out num, 0);

            return(pathQueryStatus & ~PathQueryStatus.BufferTooSmall);
        }