85 lines
3.4 KiB
C#
85 lines
3.4 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace Thousandto.Launcher.ExternalLibs
|
|
{
|
|
//遮挡剔除辅助划线脚本
|
|
public class OcDebugLine : MonoBehaviour
|
|
{
|
|
public OcclusionCullingUtil ocUtile = null;
|
|
|
|
public class TestLineDate
|
|
{
|
|
public Vector3 star = Vector3.zero;
|
|
public Vector3 end = Vector3.zero;
|
|
}
|
|
|
|
private void DrawLine(float height)
|
|
{
|
|
if (ocUtile == null)
|
|
return;
|
|
OcDefine type = OcDefine.OC_Small;
|
|
Gizmos.color = Color.red;
|
|
int colRow = ocUtile.ColRowList[(int)type];
|
|
List<MapCell> parts = ocUtile.DicMapCell[(int)type];
|
|
if (parts == null)
|
|
return;
|
|
int tolCl = parts.Count / ocUtile.ColRowList[(int)type]; //总行数
|
|
int tolRl = ocUtile.ColRowList[(int)type]; //总列数
|
|
for (int i = 0; i < tolCl; i++)
|
|
{
|
|
Gizmos.DrawLine(parts[i * colRow].min + new Vector3(0f, height, 0f), parts[i * colRow + (colRow - 1)].min +
|
|
new Vector3(parts[i * colRow + (colRow - 1)].bounds.size.x, height, 0f));
|
|
}
|
|
Gizmos.DrawLine(parts[(tolCl - 1) * colRow].min + new Vector3(0f, height, parts[(tolCl - 1) * colRow].bounds.size.z),
|
|
parts[(tolCl - 1) * colRow + (colRow - 1)].max + new Vector3(0f, height, 0f));
|
|
Gizmos.color = Color.blue;
|
|
for (int i = 0; i < tolRl; i++)
|
|
{
|
|
Gizmos.DrawLine(parts[i].min + new Vector3(0f, height, 0f), parts[colRow * (tolRl - 1) + i].min +
|
|
new Vector3(0f, height, parts[colRow * (tolRl - 1) + i].bounds.size.z));
|
|
}
|
|
Gizmos.DrawLine(parts[tolRl - 1].min + new Vector3(parts[tolRl - 1].bounds.size.x, height, 0f)
|
|
, parts[colRow * (tolRl - 1) + (tolRl - 1)].max + new Vector3(0f, height, 0f));
|
|
Gizmos.color = Color.blue;
|
|
//Gizmos.DrawCube(Parts[0].Center, new Vector3(Parts[0].Bounds.size.x, 0f, Parts[0].Bounds.size.z));
|
|
Gizmos.DrawCube(new Vector3(ocUtile.Min.x, 10, ocUtile.Min.y), new Vector3(10, 10, 10));
|
|
Gizmos.color = Color.green;
|
|
Gizmos.DrawCube(new Vector3(ocUtile.Max.x, 10, ocUtile.Max.y), new Vector3(10, 10, 10));
|
|
}
|
|
|
|
private void OnDrawGizmos()
|
|
{
|
|
if (ocUtile == null)
|
|
return;
|
|
for (int i = 0; i < ocUtile.VerticalSize.Count; i++)
|
|
{
|
|
DrawLine(ocUtile.VerticalSize[i]);
|
|
}
|
|
|
|
//画射线
|
|
for (int i = ocUtile.testLineList.Count - 1; i >= 0; i--)
|
|
{
|
|
Gizmos.color = Color.green;
|
|
Gizmos.DrawLine(ocUtile.testLineList[i].star, ocUtile.testLineList[i].end);
|
|
}
|
|
//for (int i = ocUtile.textboundsList.Count - 1; i >= 0; i--)
|
|
//{
|
|
// if (i == 0)
|
|
// {
|
|
// Gizmos.color = Color.green;
|
|
|
|
// }
|
|
// else if (i == 1)
|
|
// {
|
|
// Gizmos.color = Color.blue;
|
|
// }
|
|
// Gizmos.DrawCube(new Vector3(ocUtile.textboundsList[i].center.x, 35, ocUtile.textboundsList[i].center.z),
|
|
// new Vector3(ocUtile.textboundsList[i].extents.x, 2, ocUtile.textboundsList[i].extents.z));
|
|
//}
|
|
}
|
|
}
|
|
}
|
|
|