public void CheckBoomAftermath() { for (int y = (mapModel.LengthY - 1); y >= 0; --y) { for (int x = 0; x < mapModel.LengthX; ++x) { if (!mapModel.CheckShowBlock(y, x)) { continue; } int directionIndex = (x % 2); bool isBoomAftermath = false; for (int j = 0; j < mapModel.DirectionLengthY; ++j) { if (!mapModel.CheckQuestBlock(y, x)) { continue; } for (int k = 0; k < mapModel.DirectionLengthX; ++k) { Vector2Int direction = mapModel.GetDirection(directionIndex, j, k); int nextY = y + direction.y; int nextX = x + direction.x; if (mapModel.CheckRangeOver(nextY, nextX)) { continue; } Block nectBlock = mapModel.GetBlock(nextY, nextX); if (!nectBlock.IsShow) { continue; } if (nectBlock.IsQuestBlock) { continue; } if (nectBlock.IsBoom) { isBoomAftermath = true; break; } } if (isBoomAftermath) { mapModel.SetQuestCountMinus(y, x); break; } } } } }
private void RefreshBlockUnits() { for (int y = 0; y < mapModel.LengthY; ++y) { for (int x = 0; x < mapModel.LengthX; ++x) { int posY = mapModel.LengthY - y; int index = (mapModel.LengthX * y) + x; if (index == hexaBlockUnits.Length) { return; } int direction = x % 2 == 0 ? -1 : 1; float locationX = ITEM_SIZE * x; float locationY = (ITEM_SIZE * y) + (ITEM_SIZE * GRID_Y * direction); Vector3 pos = new Vector3(locationX, locationY, 0); if (hexaBlockUnits[index] == null) { hexaBlockUnits[index] = Instantiate(loadPrefabsHexaBlock, instanceBlockPool.transform); if (mapModel.CheckShowBlock(y, x)) { GameObject objBG = Instantiate(loadPrefabsHexaBlockBG, intanceBlockBGPool.transform); objBG.transform.localPosition = pos; } #if UNITY_EDITOR hexaBlockUnits[index].name = string.Format("{0}_{1}", y, x); #endif } hexaBlockUnits[index].transform.localPosition = pos; hexaBlockUnits[index].gameObject.SetActive(mapModel.CheckShowBlock(y, x)); hexaBlockUnits[index].SetBlock(mapModel.GetBlock(y, x)); hexaBlockUnits[index].Show(); } } }