Files

46 lines
1.4 KiB
C#
Raw Permalink Normal View History

2025-01-25 04:38:09 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Thousandto.Launcher.ExternalLibs
{
/// <summary>
/// 地图cell
/// </summary>
public class MapCell
{
public int id;
public Vector3 min = Vector3.zero;
public Vector3 max = Vector3.zero;
public Bounds bounds;
public OcDefine type = OcDefine.OC_Default;
public bool isVisible;
public List<Vector3> rayEndPointList;
public MapCell(int index, int part, float celWide, float celHigh, Vector2 min, OcDefine type)
{
int rl = index % part; //列
int cl = index / part; //行
id = index;
Vector3 center = Vector3.zero;
this.min.x = min.x + celWide * rl;
this.min.z = min.y + celHigh * cl;
max.x = this.min.x + celWide;
max.z = this.min.z + celWide;
center.x = max.x - celWide / 2;
center.z = max.z - celHigh / 2;
var size = new Vector3(celWide, 400, celHigh);
bounds = new Bounds(center, size);
bounds.min = new Vector3(this.min.x, -200, this.min.z);
bounds.max = new Vector3(max.x, 200, max.z);
this.type = type;
}
public bool Intersects(Bounds b)
{
return bounds.Intersects(b);
}
}
}