//处理每回合的发牌 IEnumerator DealCard() { gameState = GameState.CardGenerating; if (currentHeroName == "hero1") { GameObject cardGo = cardGenerator.RandomGenerCard();//调用方法生成一个随机卡牌//等2秒 yield return(new WaitForSeconds(2f)); //把这个卡片放在卡牌管理器内 myCard.AddCard(cardGo); cardGo = cardGenerator.RandomGenerCard();//调用方法生成一个随机卡牌//等2秒 yield return(new WaitForSeconds(2f)); //把这个卡片放在卡牌管理器内 enemyCard.AddCard(cardGo); } else { GameObject cardGo = cardGenerator.RandomGenerCard();//调用方法生成一个随机卡牌//等2秒 yield return(new WaitForSeconds(2f)); //把这个卡片放在卡牌管理器内 enemyCard.AddCard(cardGo); } gameState = GameState.PlayCard; timer = 0; }
private IEnumerator GenerateCardForHero1(int n) { for (int i = 0; i < n; i++) { //最开始发牌是发4张牌 GameObject cardGo = this.cardGenerator.RandomGenerateCard();//调用方法随机生成一个卡牌//要等2 yield return(new WaitForSeconds(2f)); //把这个卡片放在 卡牌管理内 myCard.AddCard(cardGo); } }
private IEnumerator GenerateCardForHero1() { //first generate 4 cards int count = 4; GameObject cardGo = null; while (count > 0) { cardGo = cardGenerator.RandomGenerateCard(); yield return(new WaitForSeconds(2f)); //return card myCard.AddCard(cardGo); count--; } }