void GiveCardToHand() { //int drawNum = maxHand - handCount; //handCount = maxHand; for (int i = 0; i < drawNum; i++) { int cardID = deck[cardIndex]; int cost = cardCost; cardCost++; if (cardCost > 3) { cardCost = 1; } bool isRare; if (cost == 3 || rareDraw) { isRare = true; rareDraw = false; } else { isRare = false; } CardController cardController = cardGenerator.CreateCard(false, cardID, cost, isRare, handTransform); cardController.GetComponent <CardView>().SetCard(cardController.model); //cardController.view.SetCard(cardController.model); if (cardIndex == 8) { ShuffleCard(); cardIndex = 0; } else { cardIndex++; } } //LineUpCard(handTransform); }
public void GenerateFieldCard() { lackCostTextObject.SetActive(false); decideTextObject.SetActive(false); CleanField(); CardController[] mixCardController = new CardController[2] { null, null }; CardController eatCardController; for (int i = 0; i < 2; i++) { mixCardController[i] = null; } for (int i = 0; i < 2; i++) { if (selectCardController[i] != null) { mixCardController[i] = cardGenerator.CreateCard(false, selectCardController[i].model.cardID, selectCardController[i].model.cost, selectCardController[i].model.isRare, mixFieldTransform[i]); mixCardController[i].model.cal = selectCardController[i].model.cal; //mixCardController[i].view.SetCard(mixCardController[i].model); mixCardController[i].GetComponent <CardView>().SetCard(mixCardController[i].model); } } //if (cardID[0] == -1) //{ // uiManager.decideButtonObj.SetActive(false); // return; //} //合成チェック if (mixCardController[1] != null) { if (mixCardController[0].model.kind == mixCardController[1].model.kind) { //合成不可 //uiManager.decideButtonObj.SetActive(false); return; } else { //Debug.Log("aaa"); //合成 int mixCardID = cardGenerator.SpecialMix(mixCardController[0], mixCardController[1]); Debug.Log(mixCardID); eatCardController = cardGenerator.CreateEatCard(true, mixCardID, 0, false, mixFieldTransform[2]); //eatCardController.eatView.SetEatCard(eatCardController.model); eatCardController.GetComponent <EatCardView>().SetEatCard(eatCardController.model); //コストがある時 if (player.cost >= 3) { decideTextObject.SetActive(true); } else { lackCostTextObject.SetActive(true); } } } else if (mixCardController[0] != null) { //uiManager.decideButtonObj.SetActive(true); eatCardController = cardGenerator.CreateEatCard(false, mixCardController[0].model.cardID, mixCardController[0].model.cost, mixCardController[0].model.isRare, mixFieldTransform[2]); eatCardController.model.cal = mixCardController[0].model.cal; eatCardController.model.cost = mixCardController[0].model.cost; //eatCardController.eatView.SetEatCard(eatCardController.model); eatCardController.GetComponent <EatCardView>().SetEatCard(eatCardController.model); decideTextObject.SetActive(true); } else { return; } }
public void GenerateFieldCard() { CleanField(); messageTextObj[0].SetActive(false); messageTextObj[1].SetActive(false); CardController[] mixCardController = new CardController[2] { null, null }; CardController eatCardController; for (int i = 0; i < 2; i++) { mixCardController[i] = null; } for (int i = 0; i < 2; i++) { if (selectCardController[i] != null) { mixCardController[i] = cardGenerator.CreateCard(false, selectCardController[i].model.cardID, selectCardController[i].model.cost, selectCardController[i].model.condition, mixFieldTransform[i]); mixCardController[i].model.cal = selectCardController[i].model.cal; mixCardController[i].GetComponent <CardView>().SetCookingCard(mixCardController[i].model); mixCardController[i].GetComponent <CanvasGroup>().blocksRaycasts = false; } } //合成チェック if (mixCardController[1] != null) { if (mixCardController[0].model.kind == mixCardController[1].model.kind) { //合成不可 messageTextObj[1].SetActive(true); return; } else { //合成 int mixCardID = cardGenerator.SpecialMix(mixCardController[0], mixCardController[1]); bool isStrong = false; if (mixCardController[0].model.condition == 2 || mixCardController[1].model.condition == 2) { isStrong = true; } //チュートリアル if (GameManager.instance.tutorial) { if (GameManager.instance.tutorialNum == 0) { messageTextObj[0].SetActive(true); messageTextObj[0].GetComponent <TextMeshProUGUI>().text = "食材を1つ" + "\nえらぼう!"; return; } //レア以外を使っている場合 else if (GameManager.instance.tutorialNum == 2) { if (!isStrong) { messageTextObj[0].SetActive(true); messageTextObj[0].GetComponent <TextMeshProUGUI>().text = "レア食材を" + "\n材料にしよう!"; return; } } } eatCardController = cardGenerator.CreateEatCard(true, mixCardID, 0, 0, mixFieldTransform[2]); eatCardController.model.isStrong = isStrong; eatCardController.GetComponent <EatCardView>().SetEatCard(eatCardController.model); //コストがあってBadでない if (player.cost >= 3 && mixCardController[0].model.condition > 0 && mixCardController[1].model.condition > 0) { //eatCardController.model.canSelected = true; eatCardController.GetComponent <CanvasGroup>().blocksRaycasts = true; eatCardController.GetComponent <EatCardView>().SetErrorMessage(2); eatCardController.GetComponent <EatCardView>().StartBlinking(); } else { eatCardController.GetComponent <EatCardView>().StopBlinking(); //eatCardController.model.canSelected = false; eatCardController.GetComponent <CanvasGroup>().blocksRaycasts = false; if (player.cost < 3) { eatCardController.GetComponent <EatCardView>().SetErrorMessage(0); } else { eatCardController.GetComponent <EatCardView>().SetErrorMessage(1); } } } } else if (mixCardController[0] != null) { //チュートリアル中に単体で押せないように if (GameManager.instance.tutorial) { //bottomText.text = "好きな食材を" + "\nえらぼう!"; if (GameManager.instance.tutorialNum == 1 || GameManager.instance.tutorialNum == 2) { messageTextObj[0].SetActive(true); messageTextObj[0].GetComponent <TextMeshProUGUI>().text = "食材を2つ" + "\nえらぼう!"; return; } } eatCardController = cardGenerator.CreateEatCard(false, mixCardController[0].model.cardID, mixCardController[0].model.cost, mixCardController[0].model.condition, mixFieldTransform[2]); eatCardController.model.cal = mixCardController[0].model.cal; eatCardController.model.cost = mixCardController[0].model.cost; eatCardController.GetComponent <EatCardView>().SetEatCard(eatCardController.model); eatCardController.GetComponent <EatCardView>().StartBlinking(); //eatCardController.model.canSelected = true; eatCardController.GetComponent <CanvasGroup>().blocksRaycasts = true; eatCardController.GetComponent <EatCardView>().SetErrorMessage(2); } else { messageTextObj[0].GetComponent <TextMeshProUGUI>().text = "好きな食材を" + "\nえらぼう!"; messageTextObj[0].SetActive(true); return; } }