public void MapInit() { bool[] dest = { false, false, false }; Random rm = new Random(); Goal = rm.Next(0, 2); dest[Goal] = true; for (int i = 0; i < CONST.MAP_ROW; i++) { for (int j = 0; j < CONST.MAP_COL; j++) { if (i == 3 && j == 4) { caveCards[i, j] = new StartCard(); } else if (j == 12) { if (i == 1) { caveCards[i, j] = new DestCard(CardFace.BACK, false, dest[0]); } else if (i == 3) { caveCards[i, j] = new DestCard(CardFace.BACK, false, dest[1]); } else if (i == 5) { caveCards[i, j] = new DestCard(CardFace.BACK, false, dest[2]); } else { caveCards[i, j] = new CaveCard(); } } else { caveCards[i, j] = new CaveCard(); } } } }
private void DrawCardOnField() { CaveCard curCard = null; Point location = new Point(); for (int i = 0; i < CONST.MAP_ROW; i++) { for (int j = 0; j < CONST.MAP_COL; j++) { curCard = field.GetCard(i, j); if (prevMap[i, j] == curCard) { continue; } location = ConvertCoordsToLocation(i, j); // Draw Start Card if (curCard is StartCard) { AddImage(location, imgCards.Images[START_CARD_INDEX]); } // Draw Dest Card else if (curCard is DestCard) { DestCard dest = (DestCard)curCard; Image image; if (dest.face == CardFace.FRONT) { if (dest.getIsGoldCave()) { image = imgCards.Images["goal_gold.png"]; MessageBox.Show("금을 찾았습니다!\r\n광부 승!!"); } else { image = imgCards.Images["goal_stone_down_left.png"]; MessageBox.Show("돌입니다!\r\n다른 목적지를 방문해보세요."); } } else { image = imgCards.Images["goal_back.png"]; } AddImage(location, image); } // Draw Cave Card else { if (!curCard.isEmpty() && prevMap[i, j].isEmpty()) { Image curImage = GetCardImage(curCard); if (curImage != null) { AddImage(location, curImage); } } else if (curCard.isEmpty() && !prevMap[i, j].isEmpty()) { DeleteImage(i, j); } } prevMap[i, j].setDir(curCard.getDir()); prevMap[i, j].setIsConnected(curCard.getIsConnected()); prevMap[i, j].setType(curCard.getType()); prevMap[i, j].face = curCard.face; } } }
public bool getDestCard(Point point) { DestCard dest = (DestCard)caveCards[point.R, point.C]; return(dest.getIsGoldCave()); }