Exemplo n.º 1
0
        public void SetTargetPoint(Vector3 target, RenderData renderData, ref string resultMessage)
        {
            if (m_compiledNavMeshSet == null)
            {
                return;
            }
            if (m_testNavTarget == target)
            {
                return;
            }
            m_testNavTarget = target;
            var sg = m_compiledNavMeshSet.FindSubgraphUnderPoint(target.X, target.Y, target.Z + 4, 10);

            //   m_testString = $" TEST[pt: {c}  {(sg==null?"MESH NOT FOUND":$"{sg.BlockWidth} {sg.BlockHeight} {sg.Z1} {sg.Z2}")}]";
            renderData.astarLineVertexBuffer = CreateVertexBuffer(out resultMessage);
        }
Exemplo n.º 2
0
        public void LoadNavMeshGridUnderPosition(Vector3 position)
        {
            // TODO make sure the right compilednavmesh is loaded (currently it is hardcoded!)

            if (m_tempCompiledNavMeshSet == null)
            {
                Debug.WriteLine("m_tempCompiledNavMeshSet is null!");
                return;
            }

            var mesh = m_tempCompiledNavMeshSet.FindSubgraphUnderPoint(position.X, position.Y, position.Z);

            if (mesh == null)
            {
                Debug.WriteLine("FindSubgraphUnderPoint returned null!");
                return;
            }

            var floorLineVertices = RenderFloorLines(mesh, position, 20);

            if (floorLineVertices.Count > 0)
            {
                m_renderData.floorLineVertexBuffer = new VertexBuffer(GraphicsDevice, typeof(VertexPositionColor), floorLineVertices.Count, BufferUsage.WriteOnly);
                m_renderData.floorLineVertexBuffer.SetData <VertexPositionColor>(floorLineVertices.ToArray());
            }
        }