private void ShowSpecifiedMapItem(MapItemSize size) { for (int i = 0; i < poteniallyVisibleSetItemList.Count; i++) { PoteniallyVisibleSetItem pvsItem = poteniallyVisibleSetItemList[i]; if (pvsItem.size == size) { pvsItem.gameObject.SetActive(true); } } }
private int GetCellSize(MapItemSize size) { switch (size) { case MapItemSize.Big: return((int)bigCellSize.x); case MapItemSize.Middle: return((int)middleCellSize.x); case MapItemSize.Small: return((int)smallCellSize.x); default: return((int)bigCellSize.x); } }
private void CaptureCellGrid(MapTile tile, MapItemSize size) { Vector3 cellSize = Vector3.zero; targetAreaPointCount = 0; switch (size) { case MapItemSize.Big: cellSize = bigCellSize; targetAreaPointCount = UnityEngine.Random.Range((int)endPortalPointList.y, (int)endPortalPointList.x); break; case MapItemSize.Middle: cellSize = middleCellSize; targetAreaPointCount = UnityEngine.Random.Range((int)endPortalPointList.x, (int)endPortalPointList.y); break; case MapItemSize.Small: cellSize = smallCellSize; targetAreaPointCount = UnityEngine.Random.Range((int)endPortalPointList.w, (int)endPortalPointList.z); break; default: cellSize = bigCellSize; targetAreaPointCount = UnityEngine.Random.Range(16, 16); break; } int tileHorizontalCells = Mathf.CeilToInt(tileSize.x / cellSize.x); int tileVerticalCells = Mathf.CeilToInt(tileSize.z / cellSize.z); List <Cell> cellList = new List <Cell>(tileHorizontalCells * tileVerticalCells); for (int i = 0; i < tileHorizontalCells; i++) { for (int j = 0; j < tileVerticalCells; j++) { Cell cell = new Cell(); cell.size = size; cell.Id = cellList.Count + 1 + (tile.id - 1) * tileHorizontalCells * tileVerticalCells; cell.x = (int)(tile.x + i * cellSize.x); cell.z = (int)(tile.z + j * cellSize.z); cell.rayEndPointList = new List <Vector3>(targetAreaPointCount); for (int k = 0; k < targetAreaPointCount; k++) { Vector3 point = new Vector3(); float x = UnityEngine.Random.Range(0, cellSize.x); float z = UnityEngine.Random.Range(0, cellSize.z); point.x = cell.x + x; point.z = cell.z + z; cell.rayEndPointList.Add(point); } cellList.Add(cell); } } switch (size) { case MapItemSize.Big: tile.bigAreaList = cellList; break; case MapItemSize.Middle: tile.middleAreaList = cellList; break; case MapItemSize.Small: tile.smallAreaList = cellList; break; default: tile.bigAreaList = cellList; break; } }