示例#1
0
        public MyNavigationPrimitive FindClosestPrimitive(Vector3D point, bool highLevel, ref double closestDistanceSq, MyVoxelBase voxelMap = null)
        {
            MyNavigationPrimitive retval = null;

            if (voxelMap != null)
            {
                MyVoxelNavigationMesh mesh = null;
                if (m_navigationMeshes.TryGetValue(voxelMap, out mesh))
                {
                    retval = mesh.FindClosestPrimitive(point, highLevel, ref closestDistanceSq);
                }
            }
            else
            {
                foreach (var entry in m_navigationMeshes)
                {
                    MyNavigationPrimitive closest = entry.Value.FindClosestPrimitive(point, highLevel, ref closestDistanceSq);
                    if (closest != null)
                    {
                        retval = closest;
                    }
                }
            }

            return(retval);
        }
示例#2
0
        public MyNavigationPrimitive FindClosestPrimitive(Vector3D point, bool highLevel, ref double closestDistanceSq, MyVoxelBase voxelMap = null)
        {
            MyNavigationPrimitive primitive = null;

            if (voxelMap != null)
            {
                MyVoxelNavigationMesh mesh = null;
                if (this.m_navigationMeshes.TryGetValue(voxelMap, out mesh))
                {
                    primitive = mesh.FindClosestPrimitive(point, highLevel, ref closestDistanceSq);
                }
            }
            else
            {
                foreach (KeyValuePair <MyVoxelBase, MyVoxelNavigationMesh> pair in this.m_navigationMeshes)
                {
                    MyNavigationPrimitive primitive2 = pair.Value.FindClosestPrimitive(point, highLevel, ref closestDistanceSq);
                    if (primitive2 != null)
                    {
                        primitive = primitive2;
                    }
                }
            }
            return(primitive);
        }