Пример #1
0
    private void DebugDrawNavMesh()
    {
        RoomKey roomKey = _gameWorldController.Model.CurrentGame.CurrentRoomKey;

        AsyncRPGSharedLib.Navigation.NavMesh navMesh = PathfindingSystem.GetNavMesh(roomKey);

        if (navMesh != null)
        {
            for (uint navCellIndex = 0; navCellIndex < navMesh.GetNavCellCount(); navCellIndex++)
            {
                int connectivityId = navMesh.GetNavCellConnectivityID(navCellIndex);

                if (connectivityId != AsyncRPGSharedLib.Navigation.NavMesh.EMPTY_NAV_CELL)
                {
                    for (MathConstants.eDirection direction = MathConstants.eDirection.first;
                         direction < MathConstants.eDirection.count;
                         direction++)
                    {
                        if (!navMesh.NavCellHasNeighbor(navCellIndex, direction))
                        {
                            Point3d portalLeft, portalRight;
                            Vector3 portalVertexLeft, portalVertexRight;

                            navMesh.ComputePointsOnNavCellSide(navCellIndex, direction, out portalLeft, out portalRight);
                            portalVertexLeft  = ClientGameConstants.ConvertRoomPositionToVertexPosition(portalLeft);
                            portalVertexRight = ClientGameConstants.ConvertRoomPositionToVertexPosition(portalRight);

                            Debug.DrawLine(
                                portalVertexLeft,
                                portalVertexRight,
                                Color.yellow,
                                0.0f,   // duration
                                false); // depth test
                        }
                    }
                }
            }
        }
    }