mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 19:34:47 +00:00
83 lines
3.0 KiB
C#
83 lines
3.0 KiB
C#
|
|
using UnityEngine;
|
|
using JNGame.Math;
|
|
|
|
namespace JNGame.Map
|
|
{
|
|
/// <summary>
|
|
/// 地图数据
|
|
/// </summary>
|
|
[System.Serializable]
|
|
public class StaticMapData
|
|
{
|
|
/// <summary>
|
|
/// 地图ID
|
|
/// </summary>
|
|
public int mapID;
|
|
/// <summary>
|
|
/// 地图名
|
|
/// </summary>
|
|
public string mapName;
|
|
/// <summary>
|
|
/// 地图导航网格数据
|
|
/// </summary>
|
|
public PathFinding.NavMeshData navMeshData;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 生成地图配置逻辑数据的脚步,仅作为编辑器导出地图场景数据的入口,运行时无作用
|
|
/// </summary>
|
|
public class GenMapConfigHelper : MonoBehaviour
|
|
{
|
|
/// <summary>
|
|
/// 地图ID
|
|
/// </summary>
|
|
public int mapID;
|
|
/// <summary>
|
|
/// 地图名
|
|
/// </summary>
|
|
public string mapName;
|
|
/// <summary>
|
|
/// Unity的Navigation组件
|
|
/// </summary>
|
|
public Unity.AI.Navigation.NavMeshSurface navMeshSurface;
|
|
|
|
|
|
private void OnDrawGizmos()
|
|
{
|
|
// if (m_MapConfig == null) { return; }
|
|
// DrawNavMesh();
|
|
}
|
|
|
|
// private void DrawNavMesh()
|
|
// {
|
|
// if (m_MapConfig == null || m_MapConfig.navMeshData == null || m_MapConfig.navMeshData.pathTriangles == null) { return; }
|
|
// int i = 0;
|
|
// Gizmos.color = Color.green;
|
|
// while (i < m_MapConfig.navMeshData.pathTriangles.Length)
|
|
// {
|
|
// int aIndex = m_MapConfig.navMeshData.pathTriangles[i++];
|
|
// int bIndex = m_MapConfig.navMeshData.pathTriangles[i++];
|
|
// int cIndex = m_MapConfig.navMeshData.pathTriangles[i++];
|
|
|
|
// Vector3 vertexA = m_MapConfig.navMeshData.pathVertices[aIndex].ToVector3();
|
|
// Vector3 vertexB = m_MapConfig.navMeshData.pathVertices[bIndex].ToVector3();
|
|
// Vector3 vertexC = m_MapConfig.navMeshData.pathVertices[cIndex].ToVector3();
|
|
|
|
// Gizmos.DrawLine(vertexA, vertexB);
|
|
// Gizmos.DrawLine(vertexB, vertexC);
|
|
// Gizmos.DrawLine(vertexC, vertexA);
|
|
// }
|
|
|
|
// Gizmos.color = Color.blue;
|
|
// Vector3 bottomLeft = new LVector3(m_MapConfig.navMeshData.xMin, 0.ToLFloat(), m_MapConfig.navMeshData.zMin).ToVector3();
|
|
// Vector3 bottomRight = new LVector3(m_MapConfig.navMeshData.xMax, 0.ToLFloat(), m_MapConfig.navMeshData.zMin).ToVector3();
|
|
// Vector3 topLeft = new LVector3(m_MapConfig.navMeshData.xMin, 0.ToLFloat(), m_MapConfig.navMeshData.zMax).ToVector3();
|
|
// Vector3 topRight = new LVector3(m_MapConfig.navMeshData.xMax, 0.ToLFloat(), m_MapConfig.navMeshData.zMax).ToVector3();
|
|
// Gizmos.DrawLine(bottomLeft, bottomRight);
|
|
// Gizmos.DrawLine(bottomLeft, topLeft);
|
|
// Gizmos.DrawLine(bottomRight, topRight);
|
|
// Gizmos.DrawLine(topLeft, topRight);
|
|
// }
|
|
}
|
|
} |