public bool checkComodin(infoBaraja.cardContent card) { if (card.getNumber() < 0 && !card.checkUsed()) { return(true); } return(false); }
public bool gameRules(infoBaraja.cardContent toPut, infoBaraja.cardContent current) { bool res = toPut.getColor() == current.getColor(); res = res || toPut.getNumber() == current.getNumber(); res = res || toPut.getColor() == infoBaraja.color.white; return(res); }
// Update is called once per frame void Update() { if (infoBaraja.gameBaraja.ready == true) { if (done == false) { for (int i = 1; i <= cardsForEach; ++i) { getCard(true); } done = true; currentCardNumber = 0; printCards(); } if (hand.Count > 0) { currentCard = hand[currentCardNumber]; } else { if (cardColor != null) { Destroy(cardColor.gameObject); } gameRuntime.grt.won = true; } print(currentCard.getColor()); cardColor.color = infoBaraja.setCardColor(currentCard); cardNumber.text = currentCard.getNumber().ToString(); cardNumberBig.text = currentCard.getNumber().ToString(); if (getTimes >= 2) { gameRuntime.grt.done = true; getTimes = 0; } if (gameRuntime.grt.playerTurn == gameObject.name) { cardColor.gameObject.SetActive(true); } else { cardColor.gameObject.SetActive(false); } } print("Es un comodin?: " + checkComodin(stackManager.stackM.topCard)); print("Es positivo?: " + (stackManager.stackM.topCard.getNumber() >= 0).ToString()); cardsInHand.text = (hand.Count).ToString(); if (hand.Count == 0) { gameRuntime.grt.winner = gameObject.name; } }
// Update is called once per frame void Update() { if (infoBaraja.gameBaraja.ready == true && done == false) { stack.Add(infoBaraja.gameBaraja.shareCard()); done = true; } print("Top card: " + topCard.checkUsed()); topCard = lastCard(); stackCardColor.color = infoBaraja.setCardColor(topCard); stackCardNumber.text = topCard.getNumber().ToString(); stackCardNumberBig.text = topCard.getNumber().ToString(); }
private bool doMove(infoBaraja.cardContent c) { List <infoBaraja.cardContent> myCards = gameObject.GetComponent <playerCards>().hand; for (int i = 0; i < myCards.Count; ++i) { if (myCards[i].getColor() == c.getColor() || myCards[i].getNumber() == c.getNumber()) { gameObject.GetComponent <playerCards>().currentCardNumber = i; gameObject.GetComponent <playerCards>().putCard(); return(true); } } gameObject.GetComponent <playerCards>().getCard(false); return(false); }
public void setUsedComodin() { infoBaraja.cardContent tmp = new infoBaraja.cardContent(stack[stack.Count - 1].getColor(), stack[stack.Count - 1].getNumber(), true); stack.RemoveAt(stack.Count - 1); stack.Add(tmp); }
public void addCard(infoBaraja.cardContent c) { stack.Add(c); }