/// <summary> /// 依照3d位置,取得cell的資料 /// </summary> /// <param name="pos"></param> /// <returns></returns> public CellData GetCell(Vector3 pos) { int x = 0; int z = 0; MapUtility.GetCellIndexBy3dPosition(pos, CenterPosition, MapSizeX, MapSizeZ, ref x, ref z); return(MapDataCollection.GetCell(x, z)); }
/// <summary> /// 依照3d位置,取得cell的index /// </summary> /// <param name="pos"></param> /// <param name="xIndex"></param> /// <param name="zIndex"></param> public MapIndex GetCellIndexBy3dPosition(Vector3 pos) { int xIndex = -1; int zIndex = -1; MapUtility.GetCellIndexBy3dPosition(pos, CenterPosition, MapSizeX, MapSizeZ, ref xIndex, ref zIndex); MapIndex m; m.x = xIndex; m.z = zIndex; return(m); }
/// <summary> /// 依照3d位置,取得cell的index /// </summary> /// <param name="pos"></param> /// <param name="xIndex"></param> /// <param name="zIndex"></param> public void GetCellIndexBy3dPosition(Vector3 pos, ref int xIndex, ref int zIndex) { MapUtility.GetCellIndexBy3dPosition(pos, CenterPosition, MapSizeX, MapSizeZ, ref xIndex, ref zIndex); }